Files
RSSHub/lib/v2/quicker/versions.js
Ethan Shen d68e5a8d54 feat(route): add Quicker动作更新 (#9357)
* feat(route): add Quicker动作更新

* fix typo

* delete outdated routes

* fix: add h2 header

* fix: invalid pubDate
2022-03-31 22:32:30 +08:00

37 lines
943 B
JavaScript

const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const rootUrl = 'https://getquicker.net';
const currentUrl = `${rootUrl}/Help/Versions`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const items = $('.version')
.toArray()
.map((item) => {
item = $(item);
const a = item.find('h2 a');
return {
title: a.text().trim(),
link: `${rootUrl}${a.attr('href')}`,
description: item.find('.article-content').html(),
pubDate: parseDate(item.find('.text-secondary').first().text()),
};
});
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};