mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 23:34:38 +08:00
feat: add 央视网图片《镜象》 (#6826)
This commit is contained in:
@@ -903,6 +903,10 @@ category 对应的关键词有
|
||||
|
||||
<Route author="xfangbao" example="/xwlb" path="/xwlb/index" />
|
||||
|
||||
### 央视网图片《镜象》
|
||||
|
||||
<Route author="nczitzk" example="/cctv/photo/jx" path="/cctv/photo/jx" />
|
||||
|
||||
## 朝日新聞中文網(繁體中文版)
|
||||
|
||||
### 新聞分類
|
||||
|
||||
@@ -382,8 +382,10 @@ router.get('/mihoyo/bh2/:type', require('./routes/mihoyo/bh2'));
|
||||
|
||||
// 新闻联播
|
||||
router.get('/cctv/xwlb', require('./routes/cctv/xwlb'));
|
||||
|
||||
// 央视新闻
|
||||
router.get('/cctv/:category', require('./routes/cctv/category'));
|
||||
router.get('/cctv/photo/jx', require('./routes/cctv/jx'));
|
||||
router.get('/cctv-special/:id?', require('./routes/cctv/special'));
|
||||
|
||||
// 财新博客
|
||||
|
||||
47
lib/routes/cctv/jx.js
Normal file
47
lib/routes/cctv/jx.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://photo.cctv.com';
|
||||
const currentUrl = `${rootUrl}/jx/`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const list = $('.textr a')
|
||||
.slice(0, 10)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.text(),
|
||||
link: item.attr('href'),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.description = content('.tujitop').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '央视网图片《镜象》',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user