mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-30 18:33:08 +08:00
fix: mofcom some articles redirect (#3011)
This commit is contained in:
@@ -74,12 +74,6 @@ pageClass: routes
|
||||
|
||||
## Thunderbird
|
||||
|
||||
### Update
|
||||
|
||||
<RouteEn author="garywill" path="/thunderbird/release" example="/thunderbird/release" />
|
||||
|
||||
## Thunderbird
|
||||
|
||||
### Changelog
|
||||
|
||||
<RouteEn author="garywill" example="/thunderbird/release" path="/thunderbird/release"/>
|
||||
|
||||
@@ -23,13 +23,24 @@ module.exports = async (ctx) => {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
|
||||
const responses = await got.get(itemUrl);
|
||||
let responses = await got.get(itemUrl);
|
||||
const redirect = responses.data.match(/window\.location\.href='(.*)'/);
|
||||
if (redirect) {
|
||||
responses = await got.get(redirect[1], {
|
||||
headers: {
|
||||
Referer: itemUrl,
|
||||
'Accept-Encoding': 'gzip, deflate',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9',
|
||||
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
|
||||
},
|
||||
});
|
||||
}
|
||||
const $d = cheerio.load(responses.data);
|
||||
|
||||
const single = {
|
||||
title,
|
||||
link: itemUrl,
|
||||
description: $d('.artCon').html(),
|
||||
description: $d('.artCon').html() || $d('.textlive').html(),
|
||||
};
|
||||
ctx.cache.set(itemUrl, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
|
||||
Reference in New Issue
Block a user