mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
* fix(route): change selector path, add radar and refactor to V2 * fix: use parse-date utils * fix: use https
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
const { parseRelativeDate } = require('@/utils/parse-date');
|
|
|
|
module.exports = async (ctx) => {
|
|
const url = `https://www.yystv.cn/docs`;
|
|
const response = await got({
|
|
method: 'get',
|
|
url,
|
|
});
|
|
|
|
const data = response.data;
|
|
const $ = cheerio.load(data);
|
|
|
|
const items = $('.list-container li')
|
|
.slice(0, 18)
|
|
.map(function () {
|
|
const info = {
|
|
title: $('.list-article-title', this).text(),
|
|
link: 'https://www.yystv.cn' + $('a', this).attr('href'),
|
|
pubDate: parseRelativeDate($('.c-999', this).text()),
|
|
author: $('.handler-author-link', this).text(),
|
|
description: $('.list-article-intro', this).text(),
|
|
};
|
|
return info;
|
|
})
|
|
.get();
|
|
|
|
ctx.state.data = {
|
|
title: '游研社-' + $('title').text(),
|
|
link: `https://www.yystv.cn/docs`,
|
|
item: items,
|
|
};
|
|
};
|