Files
RSSHub/lib/routes/p-articles/utils.js
T
Sukka d82847f541 style/chore(eslint): enforce new rules (#8040)
* style: prefer object shorthand syntax
* refactor: prefer Array#map over Array#forEach
* style: prefer arrow callback
* chore(eslint): update rules
* style: auto fix by eslint
2021-08-17 22:23:23 +08:00

30 lines
699 B
JavaScript

const date = require('@/utils/date');
const cheerio = require('cheerio');
const ProcessFeed = (ctx, info, data) => {
const title = info.title;
const itemUrl = info.link;
const $ = cheerio.load(data);
const author = $('div.detail_title_02 > h4 > a:nth-child(2)').text().trim();
const date_value = $('div.detail_title_02 > h4 ').text().trim();
const description = $('div.detail_contect_01').html();
const single = {
title,
link: itemUrl,
description,
author,
pubDate: date(date_value, 8),
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
};
module.exports = {
ProcessFeed,
};