From f1e7c90c3e8f4b9892a801788ee2ed442674fd6a Mon Sep 17 00:00:00 2001 From: Rick Lee <59314774+techmovie@users.noreply.github.com> Date: Thu, 24 Feb 2022 23:50:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E8=B1=86=E7=93=A3=E6=83=B3?= =?UTF-8?q?=E7=9C=8B=E5=A2=9E=E5=8A=A0Cookie=E9=85=8D=E7=BD=AE=E9=A1=B9=20?= =?UTF-8?q?(#9110)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en/install/README.md | 2 ++ docs/install/README.md | 3 +++ lib/config.js | 3 +++ lib/v2/douban/people/wish.js | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/en/install/README.md b/docs/en/install/README.md index c6f7be0fa..c28942119 100644 --- a/docs/en/install/README.md +++ b/docs/en/install/README.md @@ -604,3 +604,5 @@ See docs of the specified route and `lib/config.js` for detailed information. - Google Fonts: [API key application](https://developers.google.com/fonts/docs/developer_api#a_quick_example) - `GOOGLE_FONTS_API_KEY`: API key +- douban + - `DOUBAN_COOKIE`: Cookie of douban user \ No newline at end of file diff --git a/docs/install/README.md b/docs/install/README.md index d18ad38e1..497de10e7 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -730,3 +730,6 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行 - Google Fonts:[申请地址](https://developers.google.com/fonts/docs/developer_api#a_quick_example) - `GOOGLE_FONTS_API_KEY`: API key + +- 豆瓣想看 + - `DOUBAN_COOKIE`: 豆瓣登陆后的 Cookie 值 diff --git a/lib/config.js b/lib/config.js index 4c460b9cc..2157eaf25 100644 --- a/lib/config.js +++ b/lib/config.js @@ -224,6 +224,9 @@ const calculateValue = () => { password: envs.IG_PASSWORD, proxy: envs.IG_PROXY, }, + douban: { + cookie: envs.DOUBAN_COOKIE, + }, }; }; calculateValue(); diff --git a/lib/v2/douban/people/wish.js b/lib/v2/douban/people/wish.js index 032a7827a..15e33a226 100644 --- a/lib/v2/douban/people/wish.js +++ b/lib/v2/douban/people/wish.js @@ -2,7 +2,7 @@ const querystring = require('querystring'); const cheerio = require('cheerio'); const got = require('@/utils/got'); const torrent = require('@/utils/torrent'); - +const config = require('@/config').value; module.exports = async (ctx) => { const userid = ctx.params.userid; const routeParams = querystring.parse(ctx.params.routeParams); @@ -25,6 +25,7 @@ module.exports = async (ctx) => { url, headers: { Referer: url, + Cookie: config.douban.cookie || '', }, }).then((response) => { const data = response.data;