diff --git a/docs/README.md b/docs/README.md index 242c6ed8a4..97d4471826 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2733,7 +2733,7 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的 - + ### Keep diff --git a/docs/en/README.md b/docs/en/README.md index d80b5ed4fe..d6fa4871c8 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -362,7 +362,7 @@ EZTV provides an official RSS feed of all torrents: https://eztv.ag/ezrss.xml - + ### Google diff --git a/lib/routes/hexo/yilia.js b/lib/routes/hexo/yilia.js index 07af62e4f9..db2ddcd637 100644 --- a/lib/routes/hexo/yilia.js +++ b/lib/routes/hexo/yilia.js @@ -3,45 +3,29 @@ const axios = require('../../utils/axios'); module.exports = async (ctx) => { const url = `http://${ctx.params.url}`; - const res = await axios.get(`${url}/archives`); + const res = await axios.get(url); const data = res.data; const $ = cheerio.load(data); - const list = $('.archive-type-post'); - const item = await Promise.all( - Array.from(list).map(async (each) => { - const itemLink = $(each) - .find('.archive-article-title') - .attr('href'); - const item = { - title: $(each) - .find('.archive-article-title') - .text(), - link: encodeURI(`${url}${itemLink}`), - }; - const key = item.link; - const value = await ctx.cache.get(key); + const authorInfo = $('.left-col').find('#header'); + const title = authorInfo.find('.header-author').text(); + const subtitle = authorInfo.find('.header-subtitle').text(); + const articleNodeList = $('article'); + const articles = Array.from(articleNodeList).map((article) => { + const each = $(article); + const titleEl = each.find('.article-title'); + + return { + title: titleEl.text(), + link: encodeURI(`${url}${titleEl.attr('href')}`), + description: each.find('.article-entry').text(), + pubDate: each.find('time').attr('datetime'), + }; + }); - if (value) { - item.description = value; - } else { - const storyDeatil = await axios.get(item.link); - const data = storyDeatil.data; - const $ = cheerio.load(data); - item.pubDate = $('time').attr('datetime'); - item.description = $('.article-entry').html(); - ctx.cache.set(key, item.description, 6 * 60 * 60); - } - return Promise.resolve(item); - }) - ); ctx.state.data = { - title: $('.header-author') - .find('a') - .text(), + title, link: url, - description: $('.header-subtitle') - .eq(0) - .text(), - item, + description: subtitle, + item: articles, }; };