Files
RSSHub/lib/v2/yystv/docs.js
T
2024-02-28 16:33:13 +08:00

35 lines
1006 B
JavaScript

import got from '@/utils/got';
import { load } from 'cheerio';
import { parseRelativeDate } from '@/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 $ = 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.set('data', {
title: '游研社-' + $('title').text(),
link: `https://www.yystv.cn/docs`,
item: items,
});
};