fix: 少数派 tag 订阅不支持中文关键词 (#3626)

close #3612
This commit is contained in:
Jeason0228 2019-12-24 17:41:28 +08:00 committed by DIYgod
parent 8066ff5f5a
commit 99f18919b1
1 changed files with 3 additions and 2 deletions

View File

@ -3,8 +3,9 @@ const cheerio = require('cheerio');
module.exports = async (ctx) => {
const keyword = ctx.params.keyword;
const api_url = `https://sspai.com/api/v1/articles?offset=0&limit=50&has_tag=1&tag=${keyword}&include_total=false`;
const host = `https://beta.sspai.com/tag/${keyword}`;
const keyword_encode = encodeURIComponent(keyword);
const api_url = `https://sspai.com/api/v1/articles?offset=0&limit=50&has_tag=1&tag=${keyword_encode}&include_total=false`;
const host = `https://beta.sspai.com/tag/${keyword_encode}`;
const resp = await got({
method: 'get',
url: api_url,