rss: use zhihu cookie to prevent being banned

This commit is contained in:
DIYgod 2018-05-29 00:00:15 +08:00
parent 7a8da68062
commit c05208a39e
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
6 changed files with 8 additions and 0 deletions

View File

@ -36,4 +36,7 @@ module.exports = {
github: {
access_token: process.env.GITHUB_ACCESS_TOKEN,
},
zhihu: {
cookie: process.env.ZHIHU_COOKIE,
},
};

View File

@ -12,6 +12,7 @@ module.exports = async (ctx) => {
Referer: `https://www.zhihu.com/people/${id}/activities`,
authorization: 'oauth c3cef7c66a1843f8b3a9e6a1e3160e20',
'X-API-VERSION': '3.0.40',
cookie: config.zhihu.cookie,
},
});

View File

@ -12,6 +12,7 @@ module.exports = async (ctx) => {
Referer: `https://www.zhihu.com/people/${id}/answers`,
authorization: 'oauth c3cef7c66a1843f8b3a9e6a1e3160e20',
'X-API-VERSION': '3.0.40',
cookie: config.zhihu.cookie,
},
});

View File

@ -11,6 +11,7 @@ module.exports = async (ctx) => {
headers: {
'User-Agent': config.ua,
Referer: `https://www.zhihu.com/collection/${id}`,
cookie: config.zhihu.cookie,
},
});

View File

@ -11,6 +11,7 @@ module.exports = async (ctx) => {
headers: {
'User-Agent': config.ua,
Referer: 'https://news-at.zhihu.com/api/4/news/latest',
cookie: config.zhihu.cookie,
},
});
// 根据api的说明过滤掉极个别站外链接

View File

@ -10,6 +10,7 @@ module.exports = async (ctx) => {
headers: {
'User-Agent': config.ua,
Referer: `https://zhuanlan.zhihu.com/${id}`,
cookie: config.zhihu.cookie,
},
});
const infoRes = await axios({