mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
@@ -5,13 +5,13 @@ module.exports = async (ctx) => {
|
||||
const url = `http://www.bjnews.com.cn/${ctx.params.cat}`;
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
const list = $('#news_ul li').get();
|
||||
const list = $('#waterfall-container .pin_demo > a').get();
|
||||
|
||||
const out = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
const time = $('p').text();
|
||||
const title = $('a').text();
|
||||
|
||||
const title = $('.pin_tit').text();
|
||||
const itemUrl = $('a').attr('href');
|
||||
const cache = await ctx.cache.get(itemUrl);
|
||||
if (cache) {
|
||||
@@ -20,13 +20,15 @@ module.exports = async (ctx) => {
|
||||
|
||||
const responses = await got.get(itemUrl);
|
||||
const $d = cheerio.load(responses.data);
|
||||
$d('img').each((i, e) => $(e).attr('referrerpolicy', 'no-referrer'));
|
||||
|
||||
const single = {
|
||||
title,
|
||||
pubDate: new Date(time).toUTCString(),
|
||||
pubDate: new Date($d('.left-info .timer').text()),
|
||||
author: $d('.left-info .reporter').text(),
|
||||
link: itemUrl,
|
||||
guid: itemUrl,
|
||||
description: $d('#main .content').html(),
|
||||
description: $d('#contentStr').html(),
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
|
||||
Reference in New Issue
Block a user