From ba1824ba5156d807651993ac382e132f3af01eee Mon Sep 17 00:00:00 2001 From: simoin Date: Tue, 13 Oct 2020 18:30:18 +0800 Subject: [PATCH] fix: aiyanxishe (#5858) --- lib/routes/aiyanxishe/home.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/routes/aiyanxishe/home.js b/lib/routes/aiyanxishe/home.js index 4043c56339..42ad9dc46c 100644 --- a/lib/routes/aiyanxishe/home.js +++ b/lib/routes/aiyanxishe/home.js @@ -4,7 +4,7 @@ module.exports = async (ctx) => { const id = ctx.params.id; const sort = ctx.params.sort || 'new'; - let url = 'https://www.leiphone.com/club/api?page=1&size=30&parent_tag='; + let url = 'https://api.yanxishe.com/api?page=1&size=30&parent_tag='; if (id === 'all') { url += '&tag='; @@ -23,7 +23,7 @@ module.exports = async (ctx) => { method: 'GET', url: url, headers: { - Referer: `https://www.leiphone.com/club/api?page=1&size=30&is_hot=0&is_recommend=0&tag=&parent_tag='`, + Referer: `https://www.yanxishe.com/`, }, }); @@ -35,12 +35,16 @@ module.exports = async (ctx) => { case 'blog': // 博客 description = data.content; author = data.user.nickname; - link = `https://ai.yanxishe.com/page/blogDetail/${id}`; + if (data.relation_special) { + link = `https://www.yanxishe.com/columnDetail/${id}`; + } else { + link = `https://www.yanxishe.com/blogDetail/${id}`; + } break; case 'question': // 问答 description = data.content; author = data.user.nickname; - link = `https://ai.yanxishe.com/page/questionDetail/${id}`; + link = `https://www.yanxishe.com/questionDetail/${id}`; break; case 'article': // 翻译 description = ``; @@ -60,7 +64,7 @@ module.exports = async (ctx) => { } `; author = data.user.nickname; - link = `https://ai.yanxishe.com/page/TextTranslation/${id}`; + link = `https://www.yanxishe.com/TextTranslation/${id}`; break; case 'paper': // 论文 description = `

标题

${data.paper.title}

`; @@ -70,7 +74,7 @@ module.exports = async (ctx) => { description += `

摘要

${data.paper.description}

`; description += `

推荐理由

${data.paper.userInfo.nickname} : ${data.paper.recommend_reason}

`; author = data.paper.userInfo.nickname; - link = `https://ai.yanxishe.com/page/paperDetail/${id}`; + link = `https://paper.yanxishe.com/review/${id}`; break; default: description = '暂不支持此类型,请到 https://github.com/DIYgod/RSSHub/issues 反馈'; @@ -83,11 +87,14 @@ module.exports = async (ctx) => { const items = await Promise.all( response.data.data.all.map(async (item) => { - let itemUrl = item.url; + let itemUrl = `https://api.yanxishe.com/api/sthread/${item.id}?token=null`; - // 修复论文链接 - if (item.type === 'paper') { - itemUrl = 'https://www.leiphone.com/club/api/spaper/detail?id=' + item.id; + if (item.type === 'blog') { + itemUrl += '&type=null'; + } else if (item.type === 'article') { + itemUrl = `https://api.yanxishe.com/api/stranslate/article/${item.id}?token=null&type=null`; + } else if (item.type === 'paper') { + itemUrl = `https://api.yanxishe.com/api/spaper/detail?token=null&id=${item.id}`; } const cache = await ctx.cache.get(itemUrl);
${data.title} ${data.zh_title}