mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
@@ -1908,3 +1908,7 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
|
||||
### 99% Invisible
|
||||
|
||||
<route name="Transcript" author="Ji4n1ng" example="/99percentinvisible/transcript" path="/99percentinvisible/transcript"/>
|
||||
|
||||
### 腾讯大家
|
||||
|
||||
<route name="首页" author="xyqfer" example="/dajia/index" path="/dajia/index"/>
|
||||
|
||||
@@ -658,4 +658,7 @@ router.get('/99percentinvisible/transcript', require('./routes/99percentinvisibl
|
||||
// Hermes UK
|
||||
router.get('/parcel/hermesuk/:tracking', require('./routes/parcel/hermesuk'));
|
||||
|
||||
// 腾讯大家
|
||||
router.get('/dajia/index', require('./routes/dajia/'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const listRes = await axios({
|
||||
method: 'get',
|
||||
url: 'http://i.match.qq.com/ninjayc/dajia?action=getwenz&p=0&num=20&callback=',
|
||||
headers: {
|
||||
Referer: 'http://dajia.qq.com/m/index.html',
|
||||
},
|
||||
});
|
||||
|
||||
const storyList = JSON.parse(listRes.data.slice(1, -2)).data;
|
||||
const resultItem = await Promise.all(
|
||||
storyList.map(async (story) => {
|
||||
const url = story.n_mobile_url;
|
||||
const item = {
|
||||
title: story.n_title,
|
||||
description: '',
|
||||
link: url,
|
||||
author: story.name,
|
||||
pubDate: new Date(story.n_publishtime).toUTCString(),
|
||||
};
|
||||
const key = `tx-dajia: ${url}`;
|
||||
const value = await ctx.cache.get(key);
|
||||
|
||||
if (value) {
|
||||
item.description = value;
|
||||
} else {
|
||||
const storyDetail = await axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
headers: {
|
||||
Referer: url,
|
||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(storyDetail.data);
|
||||
$('#articleContent img').each(function(_, item) {
|
||||
const $img = $(item);
|
||||
const src = $img.attr('src');
|
||||
|
||||
if (!(src.startsWith('https://') || src.startsWith('http://'))) {
|
||||
$img.attr('src', `https:${src}`);
|
||||
}
|
||||
|
||||
$img.attr('referrerpolicy', 'no-referrer');
|
||||
});
|
||||
|
||||
item.description = $('#articleContent').html();
|
||||
ctx.cache.set(key, item.description, 24 * 60 * 60);
|
||||
}
|
||||
|
||||
return Promise.resolve(item);
|
||||
})
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '腾讯大家',
|
||||
link: 'http://dajia.qq.com/',
|
||||
item: resultItem,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user