mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 15:21:59 +08:00
Support fulltext acquirement in infzm (#8590)
This commit is contained in:
@@ -707,3 +707,6 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行
|
||||
- `EH_IPB_MEMBER_ID`: E-Hentai 账户登录后 cookie 的 `ipb_member_id` 值
|
||||
- `EH_IPB_PASS_HASH`: E-Hentai 账户登录后 cookie 的 `ipb_pass_hash` 值
|
||||
- `EH_SK`: E-Hentai 账户登录后 cookie 中的`sk`值
|
||||
|
||||
- 南方周末付费全文
|
||||
- `INFZM_COOKIE`: infzm 账户登陆后的 cookie,目前只需要 `passport_session=...` 即可获取全文
|
||||
|
||||
@@ -202,6 +202,9 @@ const calculateValue = () => {
|
||||
ipb_pass_hash: envs.EH_IPB_PASS_HASH,
|
||||
sk: envs.EH_SK,
|
||||
},
|
||||
infzm: {
|
||||
cookie: envs.INFZM_COOKIE,
|
||||
},
|
||||
};
|
||||
};
|
||||
calculateValue();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const config = require('@/config').value;
|
||||
const got = require('@/utils/got');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const cheerio = require('cheerio');
|
||||
@@ -28,26 +29,17 @@ module.exports = async (ctx) => {
|
||||
if (value) {
|
||||
description = value;
|
||||
} else {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `http://api.infzm.com/mobile/contents/${id}`,
|
||||
});
|
||||
|
||||
if (response.data.code === 200) {
|
||||
description = response.data.data.content.fulltext;
|
||||
} else {
|
||||
// 有时候接口会返回未发布但实际已发布
|
||||
const cookie = config.infzm.cookie;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `http://www.infzm.com/content/${id}`,
|
||||
headers: {
|
||||
Referer: link,
|
||||
Cookie: `PHPSESSID=${Math.floor(Math.random() * 100)};`,
|
||||
Cookie: cookie || `passport_session=${Math.floor(Math.random() * 100)};`,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
description = $('#content').html();
|
||||
}
|
||||
description = $('div.nfzm-content__content').html();
|
||||
|
||||
ctx.cache.set(key, description);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user