diff --git a/docs/install/README.md b/docs/install/README.md index e708e7ff8..6a10f49db 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -543,5 +543,4 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行 - 新榜 - - `NEWRANK_USERNAME`: 用户名 - - `NEWRANK_PASSWORD`: 密码 + - `NEWRANK_COOKIE`: 登陆后的 COOKIE 值,其中 token 是必要的,其他可删除 diff --git a/docs/social-media.md b/docs/social-media.md index d060ec91d..13acc5533 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -903,7 +903,7 @@ rule ## 新榜 ::: warning 注意 -部署时需要配置 NEWRANK_USERNAME、NEWRANK_PASSWORD,具体见部署文档 +部署时需要配置 NEWRANK_COOKIE,具体见部署文档 请勿过高频抓取,新榜疑似对每天调用 token 总次数进行了限制,超限会报错 ::: diff --git a/lib/config.js b/lib/config.js index f4762b267..76ff136f4 100644 --- a/lib/config.js +++ b/lib/config.js @@ -157,8 +157,7 @@ const calculateValue = () => { refresh_token: envs.XIAOYUZHOU_TOKEN, }, newrank: { - username: envs.NEWRANK_USERNAME, - password: envs.NEWRANK_PASSWORD, + cookie: envs.NEWRANK_COOKIE, }, }; }; diff --git a/lib/routes/newrank/douyin.js b/lib/routes/newrank/douyin.js index 6e8c128e9..087f48b2b 100644 --- a/lib/routes/newrank/douyin.js +++ b/lib/routes/newrank/douyin.js @@ -1,11 +1,12 @@ const got = require('@/utils/got'); const utils = require('./utils'); +const config = require('@/config').value; module.exports = async (ctx) => { const uid = ctx.params.dyid; const nonce = utils.random_nonce(9); const url_detail = 'https://xd.newrank.cn/xdnphb/nr/cloud/douyin/detail/aweme?xyz=' + utils.decrypt_douyin_detail_xyz(nonce) + '&nonce=' + nonce; - const cookie = await utils.getCookie(ctx); + const cookie = String(config.newrank.cookie); const response_detail = await got({ method: 'post', url: url_detail, diff --git a/lib/routes/newrank/utils.js b/lib/routes/newrank/utils.js index ff4d0e1e6..fff1835d5 100644 --- a/lib/routes/newrank/utils.js +++ b/lib/routes/newrank/utils.js @@ -65,6 +65,7 @@ async function clearCookie(ctx) { ctx.cache.set(newrank_cookie_token, null); } +// 加了验证码失效了 async function getCookie(ctx) { // Check if this key should be replace? every 30 times should be fine. await shouldUpdateCookie(ctx); diff --git a/lib/routes/newrank/wechat.js b/lib/routes/newrank/wechat.js index 365591501..22a42e357 100644 --- a/lib/routes/newrank/wechat.js +++ b/lib/routes/newrank/wechat.js @@ -1,5 +1,6 @@ const got = require('@/utils/got'); const utils = require('./utils'); +const config = require('@/config').value; module.exports = async (ctx) => { const uid = ctx.params.wxid; @@ -9,7 +10,7 @@ module.exports = async (ctx) => { url: 'https://www.newrank.cn/xdnphb/detail/v1/rank/article/lists', headers: { Connection: 'keep-alive', - Cookie: await utils.getCookie(ctx), + Cookie: String(config.newrank.cookie), }, form: { account: uid,