diff --git a/lib/routes/18comic/index.ts b/lib/routes/18comic/index.ts index c8f144f092..054145fe42 100644 --- a/lib/routes/18comic/index.ts +++ b/lib/routes/18comic/index.ts @@ -55,5 +55,5 @@ async function handler(ctx) { const currentUrl = `${rootUrl}/albums${category === 'all' ? '' : `/${category}`}${keyword ? `?screen=${keyword}` : '?'}${time === 'a' ? '' : `&t=${time}`}${order === 'mr' ? '' : `&o=${order}`}`; - ctx.set('data', await ProcessItems(ctx, currentUrl, rootUrl)); + return await ProcessItems(ctx, currentUrl, rootUrl); } diff --git a/lib/routes/18comic/search.ts b/lib/routes/18comic/search.ts index 2e2bcbadf8..535324ed92 100644 --- a/lib/routes/18comic/search.ts +++ b/lib/routes/18comic/search.ts @@ -44,5 +44,5 @@ async function handler(ctx) { const currentUrl = `${rootUrl}/search/${option}${category === 'all' ? '' : `/${category}`}${keyword ? `?search_query=${keyword}` : '?'}${time === 'a' ? '' : `&t=${time}`}${order === 'mr' ? '' : `&o=${order}`}`; - ctx.set('data', await ProcessItems(ctx, currentUrl, rootUrl)); + return await ProcessItems(ctx, currentUrl, rootUrl); } diff --git a/lib/routes/56kog/class.ts b/lib/routes/56kog/class.ts index b049ce2280..c0f4956471 100644 --- a/lib/routes/56kog/class.ts +++ b/lib/routes/56kog/class.ts @@ -33,5 +33,5 @@ async function handler(ctx) { const currentUrl = new URL(`class/${category}.html`, rootUrl).href; - ctx.set('data', await fetchItems(limit, currentUrl, cache.tryGet)); + return await fetchItems(limit, currentUrl, cache.tryGet); } diff --git a/lib/routes/56kog/top.ts b/lib/routes/56kog/top.ts index 5ab6b2f7e4..0f4465f931 100644 --- a/lib/routes/56kog/top.ts +++ b/lib/routes/56kog/top.ts @@ -29,5 +29,5 @@ async function handler(ctx) { const currentUrl = new URL(`top/${category.split(/_/)[0]}_1.html`, rootUrl).href; - ctx.set('data', await fetchItems(limit, currentUrl, cache.tryGet)); + return await fetchItems(limit, currentUrl, cache.tryGet); } diff --git a/lib/routes/95mm/category.ts b/lib/routes/95mm/category.ts index a2cb06fff9..a77f41ee2e 100644 --- a/lib/routes/95mm/category.ts +++ b/lib/routes/95mm/category.ts @@ -42,5 +42,5 @@ async function handler(ctx) { const currentUrl = `${rootUrl}/category-${category}/list-1/index.html?page=1`; - ctx.set('data', await ProcessItems(ctx, categories[category], currentUrl)); + return await ProcessItems(ctx, categories[category], currentUrl); } diff --git a/lib/routes/95mm/tab.ts b/lib/routes/95mm/tab.ts index aca222ccde..c0286d4c38 100644 --- a/lib/routes/95mm/tab.ts +++ b/lib/routes/95mm/tab.ts @@ -30,5 +30,5 @@ async function handler(ctx) { const currentUrl = `${rootUrl}/home-ajax/index.html?tabcid=${tab}&page=1`; - ctx.set('data', await ProcessItems(ctx, tab, currentUrl)); + return await ProcessItems(ctx, tab, currentUrl); } diff --git a/lib/routes/95mm/tag.ts b/lib/routes/95mm/tag.ts index e311f60a76..93c34523ad 100644 --- a/lib/routes/95mm/tag.ts +++ b/lib/routes/95mm/tag.ts @@ -28,5 +28,5 @@ async function handler(ctx) { const currentUrl = `${rootUrl}/tag-${tag}/page-1/index.html`; - ctx.set('data', await ProcessItems(ctx, tag, currentUrl)); + return await ProcessItems(ctx, tag, currentUrl); } diff --git a/lib/routes/aiea/index.ts b/lib/routes/aiea/index.ts index b166cdc5a9..687c75a7e9 100644 --- a/lib/routes/aiea/index.ts +++ b/lib/routes/aiea/index.ts @@ -46,21 +46,18 @@ async function handler(ctx) { break; } - ctx.set( - 'data', - await buildData({ - link, - url: link, - title: `%title%`, - params: { - title: 'AIEA Seminars', - }, - item: { - item: `.seminar-contents .seminar-partWrap:nth-child(${nth_child}) > .seminar-list`, - title: `$('.seminar-list-title > span').text()`, - link: `$('a[href^="/0504"]').attr('href')`, - description: `$('.seminar-list .txt > .title').text()`, - }, - }) - ); + return await buildData({ + link, + url: link, + title: `%title%`, + params: { + title: 'AIEA Seminars', + }, + item: { + item: `.seminar-contents .seminar-partWrap:nth-child(${nth_child}) > .seminar-list`, + title: `$('.seminar-list-title > span').text()`, + link: `$('a[href^="/0504"]').attr('href')`, + description: `$('.seminar-list .txt > .title').text()`, + }, + }); } diff --git a/lib/routes/airchina/index.ts b/lib/routes/airchina/index.ts index 21d874846b..8255515025 100644 --- a/lib/routes/airchina/index.ts +++ b/lib/routes/airchina/index.ts @@ -27,7 +27,7 @@ export const route: Route = { url: 'www.airchina.com.cn/', }; -async function handler(ctx) { +async function handler() { const link = `${baseUrl}/cn/info/new-service/service_announcement.shtml`; const data = await buildData({ link, @@ -58,5 +58,5 @@ async function handler(ctx) { }) ); - ctx.set('data', data); + return data; } diff --git a/lib/routes/bangumi/tv/subject/index.ts b/lib/routes/bangumi/tv/subject/index.ts index 92c05922c3..2fd88b9eea 100644 --- a/lib/routes/bangumi/tv/subject/index.ts +++ b/lib/routes/bangumi/tv/subject/index.ts @@ -50,5 +50,5 @@ async function handler(ctx) { default: throw new Error(`暂不支持对${type}的订阅`); } - ctx.set('data', response); + return response; } diff --git a/lib/routes/bilibili/user-channel.ts b/lib/routes/bilibili/user-channel.ts index 409080e05c..db02b81b44 100644 --- a/lib/routes/bilibili/user-channel.ts +++ b/lib/routes/bilibili/user-channel.ts @@ -48,8 +48,7 @@ async function handler(ctx) { }); if (!channelInfo) { - ctx.set('data', notFoundData); - return; + return notFoundData; } const [userName, face] = await cacheIn.getUsernameAndFaceFromUID(uid); const host = `https://api.bilibili.com/x/series/archives?mid=${uid}&series_id=${sid}&only_normal=true&sort=desc&pn=1&ps=${limit}`; @@ -62,8 +61,7 @@ async function handler(ctx) { const data = response.data.data; if (!data.archives) { - ctx.set('data', notFoundData); - return; + return notFoundData; } return { diff --git a/lib/routes/bilibili/user-collection.ts b/lib/routes/bilibili/user-collection.ts index 0302266e9c..b8193a090f 100644 --- a/lib/routes/bilibili/user-collection.ts +++ b/lib/routes/bilibili/user-collection.ts @@ -44,8 +44,7 @@ async function handler(ctx) { const data = response.data.data; if (!data.archives) { - ctx.set('data', notFoundData); - return; + return notFoundData; } return { diff --git a/lib/routes/brooklynmuseum/exhibitions.ts b/lib/routes/brooklynmuseum/exhibitions.ts index c293eed70f..4b8aecb10f 100644 --- a/lib/routes/brooklynmuseum/exhibitions.ts +++ b/lib/routes/brooklynmuseum/exhibitions.ts @@ -32,18 +32,15 @@ async function handler(ctx) { link = `https://www.brooklynmuseum.org/exhibitions/${state}`; } - ctx.set( - 'data', - await buildData({ - link, - url: link, - title: 'Brooklyn Museum - Exhibitions', - item: { - item: '.exhibitions .image-card', - title: `$('h2 > a, h3 > a').text()`, - link: `$('h2 > a, h3 > a').attr('href')`, - description: `$('h6').text()`, - }, - }) - ); + return await buildData({ + link, + url: link, + title: 'Brooklyn Museum - Exhibitions', + item: { + item: '.exhibitions .image-card', + title: `$('h2 > a, h3 > a').text()`, + link: `$('h2 > a, h3 > a').attr('href')`, + description: `$('h6').text()`, + }, + }); } diff --git a/lib/routes/cctv/category.ts b/lib/routes/cctv/category.ts index e10f5e065f..6b43207b9f 100644 --- a/lib/routes/cctv/category.ts +++ b/lib/routes/cctv/category.ts @@ -42,5 +42,5 @@ async function handler(ctx) { responseData = await getNews(category); } - ctx.set('data', responseData); + return responseData; } diff --git a/lib/routes/coomer/artist.ts b/lib/routes/coomer/artist.ts index 8a9472cd44..50146f0617 100644 --- a/lib/routes/coomer/artist.ts +++ b/lib/routes/coomer/artist.ts @@ -27,5 +27,5 @@ async function handler(ctx) { const currentUrl = `onlyfans/user/${id}`; - ctx.set('data', await fetchItems(ctx, currentUrl)); + return await fetchItems(ctx, currentUrl); } diff --git a/lib/routes/coomer/posts.ts b/lib/routes/coomer/posts.ts index 5086ed20ee..5fc9d57979 100644 --- a/lib/routes/coomer/posts.ts +++ b/lib/routes/coomer/posts.ts @@ -26,5 +26,5 @@ export const route: Route = { async function handler(ctx) { const currentUrl = 'posts'; - ctx.set('data', await fetchItems(ctx, currentUrl)); + return await fetchItems(ctx, currentUrl); } diff --git a/lib/routes/dapenti/subject.ts b/lib/routes/dapenti/subject.ts index e8c9d5d23f..875ded5c7b 100644 --- a/lib/routes/dapenti/subject.ts +++ b/lib/routes/dapenti/subject.ts @@ -20,5 +20,5 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set('data', await utils.parseFeed({ subjectid: ctx.req.param('id') })); + return await utils.parseFeed({ subjectid: ctx.req.param('id') }); } diff --git a/lib/routes/dapenti/tugua.ts b/lib/routes/dapenti/tugua.ts index 485e22b351..ce11d934d2 100644 --- a/lib/routes/dapenti/tugua.ts +++ b/lib/routes/dapenti/tugua.ts @@ -19,6 +19,6 @@ export const route: Route = { handler, }; -async function handler(ctx) { - ctx.set('data', await utils.parseFeed({ subjectid: 70 })); +async function handler() { + return await utils.parseFeed({ subjectid: 70 }); } diff --git a/lib/routes/dlsite/index.ts b/lib/routes/dlsite/index.ts index 36584187bc..2afcd59443 100644 --- a/lib/routes/dlsite/index.ts +++ b/lib/routes/dlsite/index.ts @@ -9,5 +9,5 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set('data', await ProcessItems(ctx)); + return await ProcessItems(ctx); } diff --git a/lib/routes/dol/announce.ts b/lib/routes/dol/announce.ts index 841af46d54..19c123f71d 100644 --- a/lib/routes/dol/announce.ts +++ b/lib/routes/dol/announce.ts @@ -46,8 +46,7 @@ async function handler(ctx) { const slcProvince = $(`select#searchprovince option:contains('${province}')`); if (!slcProvince.length) { - ctx.set('data', result); - return; + return result; } queryParams.searchprovince = slcProvince.attr('value'); @@ -57,8 +56,7 @@ async function handler(ctx) { const slcOffice = $(`select#searchoffice option:contains('${office}')`); if (!slcOffice.length) { - ctx.set('data', result); - return; + return result; } queryParams.searchoffice = slcOffice.attr('value'); @@ -107,5 +105,5 @@ async function handler(ctx) { }; }); - ctx.set('data', result); + return result; } diff --git a/lib/routes/douban/other/latest-music.ts b/lib/routes/douban/other/latest-music.ts index ece4a0e229..2bd39e43a1 100644 --- a/lib/routes/douban/other/latest-music.ts +++ b/lib/routes/douban/other/latest-music.ts @@ -92,5 +92,5 @@ async function handler(ctx) { }; } - ctx.set('data', data); + return data; } diff --git a/lib/routes/dribbble/keyword.ts b/lib/routes/dribbble/keyword.ts index 972d5f8a56..3e2b933aa9 100644 --- a/lib/routes/dribbble/keyword.ts +++ b/lib/routes/dribbble/keyword.ts @@ -25,5 +25,5 @@ async function handler(ctx) { const title = `Dribbble - keyword ${keyword}`; - ctx.set('data', await utils.getData(ctx, url, title)); + return await utils.getData(ctx, url, title); } diff --git a/lib/routes/dribbble/popular.ts b/lib/routes/dribbble/popular.ts index eb91c6dd62..4d01e69a3d 100644 --- a/lib/routes/dribbble/popular.ts +++ b/lib/routes/dribbble/popular.ts @@ -30,5 +30,5 @@ async function handler(ctx) { const title = 'Dribbble - Popular Shots'; - ctx.set('data', await utils.getData(ctx, url, title)); + return await utils.getData(ctx, url, title); } diff --git a/lib/routes/dribbble/user.ts b/lib/routes/dribbble/user.ts index bfcc57028e..9f2e1d5a5a 100644 --- a/lib/routes/dribbble/user.ts +++ b/lib/routes/dribbble/user.ts @@ -28,5 +28,5 @@ async function handler(ctx) { const title = `Dribbble - user ${name}`; - ctx.set('data', await utils.getData(ctx, url, title)); + return await utils.getData(ctx, url, title); } diff --git a/lib/routes/ehentai/favorites.ts b/lib/routes/ehentai/favorites.ts index 3cd98e5143..a5a1d8ad55 100644 --- a/lib/routes/ehentai/favorites.ts +++ b/lib/routes/ehentai/favorites.ts @@ -32,18 +32,15 @@ async function handler(ctx) { const inline_set = ctx.req.param('order') === 'posted' ? 'fs_p' : 'fs_f'; const items = await EhAPI.getFavoritesItems(cache, favcat, inline_set, page, bittorrent, embed_thumb); - ctx.set( - 'data', - EhAPI.from_ex - ? { - title: 'ExHentai Favorites', - link: `https://exhentai.org/favorites.php?favcat=${favcat}&inline_set=${inline_set}`, - item: items, - } - : { - title: 'E-Hentai Favorites', - link: `https://e-hentai.org/favorites.php?favcat=${favcat}&inline_set=${inline_set}`, - item: items, - } - ); + return EhAPI.from_ex + ? { + title: 'ExHentai Favorites', + link: `https://exhentai.org/favorites.php?favcat=${favcat}&inline_set=${inline_set}`, + item: items, + } + : { + title: 'E-Hentai Favorites', + link: `https://e-hentai.org/favorites.php?favcat=${favcat}&inline_set=${inline_set}`, + item: items, + }; } diff --git a/lib/routes/ehentai/search.ts b/lib/routes/ehentai/search.ts index 7a0850e00e..537bad51ea 100644 --- a/lib/routes/ehentai/search.ts +++ b/lib/routes/ehentai/search.ts @@ -40,18 +40,15 @@ async function handler(ctx) { title = match[1]; } - ctx.set( - 'data', - EhAPI.from_ex - ? { - title: title + ' - ExHentai Search ', - link: `https://exhentai.org/?${params}`, - item: items, - } - : { - title: title + ' - E-Hentai Search ', - link: `https://e-hentai.org/?${params}`, - item: items, - } - ); + return EhAPI.from_ex + ? { + title: title + ' - ExHentai Search ', + link: `https://exhentai.org/?${params}`, + item: items, + } + : { + title: title + ' - E-Hentai Search ', + link: `https://e-hentai.org/?${params}`, + item: items, + }; } diff --git a/lib/routes/ehentai/tag.ts b/lib/routes/ehentai/tag.ts index bad95464f8..bf86407d22 100644 --- a/lib/routes/ehentai/tag.ts +++ b/lib/routes/ehentai/tag.ts @@ -28,18 +28,15 @@ async function handler(ctx) { const embed_thumb = routeParams.get('embed_thumb') || false; const items = await EhAPI.getTagItems(cache, tag, page, bittorrent, embed_thumb); - ctx.set( - 'data', - EhAPI.from_ex - ? { - title: tag + ' - ExHentai Tag', - link: `https://exhentai.org/tag/${tag}`, - item: items, - } - : { - title: tag + ' - E-Hentai Tag', - link: `https://e-hentai.org/tag/${tag}`, - item: items, - } - ); + return EhAPI.from_ex + ? { + title: tag + ' - ExHentai Tag', + link: `https://exhentai.org/tag/${tag}`, + item: items, + } + : { + title: tag + ' - E-Hentai Tag', + link: `https://e-hentai.org/tag/${tag}`, + item: items, + }; } diff --git a/lib/routes/ft/channel.ts b/lib/routes/ft/channel.ts index 93f118421f..47978c9c53 100644 --- a/lib/routes/ft/channel.ts +++ b/lib/routes/ft/channel.ts @@ -30,12 +30,9 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set( - 'data', - await utils.getData({ - site: ctx.req.param('language') === 'chinese' ? 'www' : 'big5', - channel: ctx.req.param('channel'), - ctx, - }) - ); + return await utils.getData({ + site: ctx.req.param('language') === 'chinese' ? 'www' : 'big5', + channel: ctx.req.param('channel'), + ctx, + }); } diff --git a/lib/routes/gov/moa/moa.ts b/lib/routes/gov/moa/moa.ts index ce88e42d76..018304eee3 100644 --- a/lib/routes/gov/moa/moa.ts +++ b/lib/routes/gov/moa/moa.ts @@ -26,36 +26,27 @@ async function handler(ctx) { // 特殊处理两个, 其他的栏目都可以找到那种一个列表下去的目录 if (suburl === 'xw/tpxw/') { // 图片新闻 - ctx.set( - 'data', - await dealChannel(suburl, { - channelTitleSelector: '.pub-media2-head', - listSelector: '.tupian_list li', - titleSelector: 'a[class="block w_fill ellipsis adc ahc"]', - dateSelector: 'span', - }) - ); + return await dealChannel(suburl, { + channelTitleSelector: '.pub-media2-head', + listSelector: '.tupian_list li', + titleSelector: 'a[class="block w_fill ellipsis adc ahc"]', + dateSelector: 'span', + }); } else if (suburl === 'govpublic/') { // 公开公告 - ctx.set( - 'data', - await dealChannel('govpublic/1/index.htm', { - channelTitleSelector: 'title', - listSelector: '.gongkai_centerRList li', - titleSelector: 'a', - dateSelector: 'span', - }) - ); + return await dealChannel('govpublic/1/index.htm', { + channelTitleSelector: 'title', + listSelector: '.gongkai_centerRList li', + titleSelector: 'a', + dateSelector: 'span', + }); } else { - ctx.set( - 'data', - await dealChannel(suburl, { - channelTitleSelector: '.pub-media1-head-title', - listSelector: '.ztlb', - titleSelector: 'a', - dateSelector: 'span', - }) - ); + return await dealChannel(suburl, { + channelTitleSelector: '.pub-media1-head-title', + listSelector: '.ztlb', + titleSelector: 'a', + dateSelector: 'span', + }); } } diff --git a/lib/routes/gov/safe/business.ts b/lib/routes/gov/safe/business.ts index fc9f32dd48..4fe4951c66 100644 --- a/lib/routes/gov/safe/business.ts +++ b/lib/routes/gov/safe/business.ts @@ -23,5 +23,5 @@ async function handler(ctx) { const { site = 'beijing' } = ctx.req.param(); const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 3; - ctx.set('data', await processZxfkItems(site, 'ywzx', limit)); + return await processZxfkItems(site, 'ywzx', limit); } diff --git a/lib/routes/gov/safe/complaint.ts b/lib/routes/gov/safe/complaint.ts index 796163617e..a03bb0119b 100644 --- a/lib/routes/gov/safe/complaint.ts +++ b/lib/routes/gov/safe/complaint.ts @@ -23,5 +23,5 @@ async function handler(ctx) { const { site = 'beijing' } = ctx.req.param(); const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 5; - ctx.set('data', await processZxfkItems(site, 'tsjy', limit)); + return await processZxfkItems(site, 'tsjy', limit); } diff --git a/lib/routes/gov/zhengce/zhengceku.ts b/lib/routes/gov/zhengce/zhengceku.ts index 5364da13ee..d72588e11e 100644 --- a/lib/routes/gov/zhengce/zhengceku.ts +++ b/lib/routes/gov/zhengce/zhengceku.ts @@ -23,22 +23,19 @@ async function handler(ctx) { const department = ctx.req.param('department'); const link = `http://www.gov.cn/zhengce/zhengceku/${department}/`; - ctx.set( - 'data', - await buildData({ - link, - url: link, - title: `%title%`, - description: '政府文件库, 当页的所有列表', - params: { - title: `$('.channel_tab > .noline > a').text().trim() + ' - 政府文件库'`, - }, - item: { - item: '.news_box > .list > ul > li:not(.line)', - title: `$('h4 > a').text()`, - link: `$('h4 > a').attr('href')`, - pubDate: `parseDate($('h4 > .date').text().trim())`, - }, - }) - ); + return await buildData({ + link, + url: link, + title: `%title%`, + description: '政府文件库, 当页的所有列表', + params: { + title: `$('.channel_tab > .noline > a').text().trim() + ' - 政府文件库'`, + }, + item: { + item: '.news_box > .list > ul > li:not(.line)', + title: `$('h4 > a').text()`, + link: `$('h4 > a').attr('href')`, + pubDate: `parseDate($('h4 > .date').text().trim())`, + }, + }); } diff --git a/lib/routes/grubstreet/index.ts b/lib/routes/grubstreet/index.ts index a34b508451..f6f3b38f81 100644 --- a/lib/routes/grubstreet/index.ts +++ b/lib/routes/grubstreet/index.ts @@ -18,5 +18,5 @@ async function handler(ctx) { const title = `Grub Street`; const description = `New York Magazine's Food and Restaurant Blog`; - ctx.set('data', await utils.getData(ctx, url, title, description)); + return await utils.getData(ctx, url, title, description); } diff --git a/lib/routes/hpoi/all.ts b/lib/routes/hpoi/all.ts index a63baec891..0c7943a479 100644 --- a/lib/routes/hpoi/all.ts +++ b/lib/routes/hpoi/all.ts @@ -28,5 +28,5 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set('data', await ProcessFeed('all', 0, ctx.req.param('order'))); + return await ProcessFeed('all', 0, ctx.req.param('order')); } diff --git a/lib/routes/hpoi/character.ts b/lib/routes/hpoi/character.ts index 4b53c1fff2..8dd1cfc300 100644 --- a/lib/routes/hpoi/character.ts +++ b/lib/routes/hpoi/character.ts @@ -23,5 +23,5 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set('data', await ProcessFeed('character', ctx.req.param('id'), ctx.req.param('order'))); + return await ProcessFeed('character', ctx.req.param('id'), ctx.req.param('order')); } diff --git a/lib/routes/hpoi/work.ts b/lib/routes/hpoi/work.ts index 524398d8a1..f30dbc3204 100644 --- a/lib/routes/hpoi/work.ts +++ b/lib/routes/hpoi/work.ts @@ -23,5 +23,5 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set('data', await ProcessFeed('work', ctx.req.param('id'), ctx.req.param('order'))); + return await ProcessFeed('work', ctx.req.param('id'), ctx.req.param('order')); } diff --git a/lib/routes/iiilab/index.ts b/lib/routes/iiilab/index.ts index 51deb14c45..1a37db7750 100644 --- a/lib/routes/iiilab/index.ts +++ b/lib/routes/iiilab/index.ts @@ -14,27 +14,24 @@ export const route: Route = { url: 'www.iiilab.com/', }; -async function handler(ctx) { +async function handler() { const link = baseUrl; - ctx.set( - 'data', - await buildData({ - link, - url: link, - title: `%title%`, - description: `%description%`, - params: { - title: '发现', - description: '人人都是自媒体-发现', - }, - item: { - item: '.aw-common-list > div', - title: `$('a').first().text()`, - link: `$('a').first().attr('href')`, - description: `$('.markitup-box').first().text()`, - pubDate: `parseDate($('.text-color-999').first().text(), 'YYYY-MM-DD HH:mm')`, - guid: Buffer.from(`$('a').attr('href')`).toString('base64'), - }, - }) - ); + return await buildData({ + link, + url: link, + title: `%title%`, + description: `%description%`, + params: { + title: '发现', + description: '人人都是自媒体-发现', + }, + item: { + item: '.aw-common-list > div', + title: `$('a').first().text()`, + link: `$('a').first().attr('href')`, + description: `$('.markitup-box').first().text()`, + pubDate: `parseDate($('.text-color-999').first().text(), 'YYYY-MM-DD HH:mm')`, + guid: Buffer.from(`$('a').attr('href')`).toString('base64'), + }, + }); } diff --git a/lib/routes/iqiyi/video.ts b/lib/routes/iqiyi/video.ts index b8bf75f3ef..2d99a7ef8d 100644 --- a/lib/routes/iqiyi/video.ts +++ b/lib/routes/iqiyi/video.ts @@ -73,5 +73,5 @@ async function handler(ctx) { ); browser.close(); - ctx.set('data', data); + return data; } diff --git a/lib/routes/javdb/actors.ts b/lib/routes/javdb/actors.ts index d9b4bec0a0..35aab573b2 100644 --- a/lib/routes/javdb/actors.ts +++ b/lib/routes/javdb/actors.ts @@ -45,5 +45,5 @@ async function handler(ctx) { const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} `; - ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title)); + return await utils.ProcessItems(ctx, currentUrl, title); } diff --git a/lib/routes/javdb/index.ts b/lib/routes/javdb/index.ts index f9dee4f1da..b1aa09c52b 100644 --- a/lib/routes/javdb/index.ts +++ b/lib/routes/javdb/index.ts @@ -59,5 +59,5 @@ async function handler(ctx) { const title = `${categories[category]} - JavDB - ${filters[filter] === '' ? '|' : `${filters[filter]} | `}${sorts[sort]}`; - ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title)); + return await utils.ProcessItems(ctx, currentUrl, title); } diff --git a/lib/routes/javdb/lists.ts b/lib/routes/javdb/lists.ts index 1762e8b0c4..0ed4d7425b 100644 --- a/lib/routes/javdb/lists.ts +++ b/lib/routes/javdb/lists.ts @@ -37,5 +37,5 @@ async function handler(ctx) { const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} ${sortOptions[sort]}`; - ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title)); + return await utils.ProcessItems(ctx, currentUrl, title); } diff --git a/lib/routes/javdb/makers.ts b/lib/routes/javdb/makers.ts index 5d9e91ed20..efc5cc2e10 100644 --- a/lib/routes/javdb/makers.ts +++ b/lib/routes/javdb/makers.ts @@ -46,5 +46,5 @@ async function handler(ctx) { const title = `JavDB${filters[filter] === '' ? '' : ` - ${filters[filter]}`} `; - ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title)); + return await utils.ProcessItems(ctx, currentUrl, title); } diff --git a/lib/routes/javdb/rankings.ts b/lib/routes/javdb/rankings.ts index 1545b2dd8c..06b2986a53 100644 --- a/lib/routes/javdb/rankings.ts +++ b/lib/routes/javdb/rankings.ts @@ -43,5 +43,5 @@ async function handler(ctx) { const title = 'JavDB'; - ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title)); + return await utils.ProcessItems(ctx, currentUrl, title); } diff --git a/lib/routes/javdb/search.ts b/lib/routes/javdb/search.ts index 5c6f1c9a3e..11f919cc3f 100644 --- a/lib/routes/javdb/search.ts +++ b/lib/routes/javdb/search.ts @@ -64,5 +64,5 @@ async function handler(ctx) { const title = `關鍵字 ${keyword} ${filters[filter] === '' ? '' : `+ ${filters[filter]}`} ${sorts[sort]} 搜索結果 - JavDB`; - ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title)); + return await utils.ProcessItems(ctx, currentUrl, title); } diff --git a/lib/routes/javdb/series.ts b/lib/routes/javdb/series.ts index cba5c00af0..a4feabeb00 100644 --- a/lib/routes/javdb/series.ts +++ b/lib/routes/javdb/series.ts @@ -46,5 +46,5 @@ async function handler(ctx) { const title = `JavDB${filters[filter] === '' ? '' : ` - ${filter[filter]}`} `; - ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title)); + return await utils.ProcessItems(ctx, currentUrl, title); } diff --git a/lib/routes/javdb/tags.ts b/lib/routes/javdb/tags.ts index fcdd2d86a4..57acab3433 100644 --- a/lib/routes/javdb/tags.ts +++ b/lib/routes/javdb/tags.ts @@ -43,5 +43,5 @@ async function handler(ctx) { const title = `JavDB${query === '' ? '' : ` - ${query}`} `; - ctx.set('data', await utils.ProcessItems(ctx, currentUrl, title)); + return await utils.ProcessItems(ctx, currentUrl, title); } diff --git a/lib/routes/javlibrary/bestrated.ts b/lib/routes/javlibrary/bestrated.ts index bb148e877f..770100251a 100644 --- a/lib/routes/javlibrary/bestrated.ts +++ b/lib/routes/javlibrary/bestrated.ts @@ -17,5 +17,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/vl_bestrated.php?list&mode=${mode}`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/bestreviews.ts b/lib/routes/javlibrary/bestreviews.ts index 746ab3daf7..ba3507c846 100644 --- a/lib/routes/javlibrary/bestreviews.ts +++ b/lib/routes/javlibrary/bestreviews.ts @@ -28,5 +28,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/tl_bestreviews.php?list&mode=${mode}`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/genre.ts b/lib/routes/javlibrary/genre.ts index 64c216e6c4..e4f432f4a9 100644 --- a/lib/routes/javlibrary/genre.ts +++ b/lib/routes/javlibrary/genre.ts @@ -22,5 +22,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/vl_genre.php?list&g=${genre}&mode=${mode}`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/maker.ts b/lib/routes/javlibrary/maker.ts index 4a7ed68cbb..b42254003c 100644 --- a/lib/routes/javlibrary/maker.ts +++ b/lib/routes/javlibrary/maker.ts @@ -29,5 +29,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/vl_maker.php?list&m=${maker}&mode=${mode}`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/mostwanted.ts b/lib/routes/javlibrary/mostwanted.ts index a5204d23c8..70b6ad498a 100644 --- a/lib/routes/javlibrary/mostwanted.ts +++ b/lib/routes/javlibrary/mostwanted.ts @@ -17,5 +17,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/vl_mostwanted.php?list&mode=${mode}`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/newentries.ts b/lib/routes/javlibrary/newentries.ts index 2cfbab97d6..52aba8952d 100644 --- a/lib/routes/javlibrary/newentries.ts +++ b/lib/routes/javlibrary/newentries.ts @@ -13,5 +13,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/vl_newentries.php?list`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/newrelease.ts b/lib/routes/javlibrary/newrelease.ts index 89e008a624..3310f8058d 100644 --- a/lib/routes/javlibrary/newrelease.ts +++ b/lib/routes/javlibrary/newrelease.ts @@ -17,5 +17,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/vl_newrelease.php?list&mode=${mode}`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/star.ts b/lib/routes/javlibrary/star.ts index 8ccdb4af16..526454e688 100644 --- a/lib/routes/javlibrary/star.ts +++ b/lib/routes/javlibrary/star.ts @@ -35,5 +35,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/vl_star.php?list&s=${id}&mode=${mode}`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/update.ts b/lib/routes/javlibrary/update.ts index f160044303..8327bddda5 100644 --- a/lib/routes/javlibrary/update.ts +++ b/lib/routes/javlibrary/update.ts @@ -13,5 +13,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/vl_update.php?list`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/javlibrary/user.ts b/lib/routes/javlibrary/user.ts index 5dd84c411f..719beb5f2d 100644 --- a/lib/routes/javlibrary/user.ts +++ b/lib/routes/javlibrary/user.ts @@ -18,5 +18,5 @@ async function handler(ctx) { const language = ctx.req.param('language') ?? defaultLanguage; const currentUrl = `${rootUrl}/${language}/${type}.php?list&u=${id}`; - ctx.set('data', await ProcessItems(language, currentUrl, cache.tryGet)); + return await ProcessItems(language, currentUrl, cache.tryGet); } diff --git a/lib/routes/jewishmuseum/exhibitions.ts b/lib/routes/jewishmuseum/exhibitions.ts index 29711e9cfd..2077f35ad8 100644 --- a/lib/routes/jewishmuseum/exhibitions.ts +++ b/lib/routes/jewishmuseum/exhibitions.ts @@ -19,20 +19,17 @@ export const route: Route = { handler, }; -async function handler(ctx) { +async function handler() { const link = 'https://thejewishmuseum.org/exhibitions'; - ctx.set( - 'data', - await buildData({ - link, - url: link, - title: 'Jewish Museums - Exhibitions', - item: { - item: '#current article.exhibition, #upcoming article, #past article.exhibition', - title: `$('article.exhibition h3').text()`, - link: `$('article.exhibition > a').attr('href')`, - }, - }) - ); + return await buildData({ + link, + url: link, + title: 'Jewish Museums - Exhibitions', + item: { + item: '#current article.exhibition, #upcoming article, #past article.exhibition', + title: `$('article.exhibition h3').text()`, + link: `$('article.exhibition > a').attr('href')`, + }, + }); } diff --git a/lib/routes/jike/topic-text.ts b/lib/routes/jike/topic-text.ts index aa74f29672..c5b3338df2 100644 --- a/lib/routes/jike/topic-text.ts +++ b/lib/routes/jike/topic-text.ts @@ -40,6 +40,6 @@ async function handler(ctx) { link: `https://m.okjike.com/originalPosts/${item.id}`, }; }); - ctx.set('data', result); + return result; } } diff --git a/lib/routes/jike/topic.ts b/lib/routes/jike/topic.ts index 1f8228696c..b316852a57 100644 --- a/lib/routes/jike/topic.ts +++ b/lib/routes/jike/topic.ts @@ -65,6 +65,6 @@ async function handler(ctx) { }) ); } - ctx.set('data', result); + return result; } } diff --git a/lib/routes/mihoyo/bbs/follow-list.ts b/lib/routes/mihoyo/bbs/follow-list.ts index 6368763fd5..7d6587ffd3 100644 --- a/lib/routes/mihoyo/bbs/follow-list.ts +++ b/lib/routes/mihoyo/bbs/follow-list.ts @@ -68,5 +68,5 @@ async function handler(ctx) { link, item: items, }; - ctx.set('data', data); + return data; } diff --git a/lib/routes/mihoyo/bbs/img-ranking.ts b/lib/routes/mihoyo/bbs/img-ranking.ts index de362ecb82..2f7fb63a66 100644 --- a/lib/routes/mihoyo/bbs/img-ranking.ts +++ b/lib/routes/mihoyo/bbs/img-ranking.ts @@ -138,5 +138,5 @@ async function handler(ctx) { link: url, item: items, }; - ctx.set('data', data); + return data; } diff --git a/lib/routes/mihoyo/bbs/official.ts b/lib/routes/mihoyo/bbs/official.ts index 55235369d4..22c31c5523 100644 --- a/lib/routes/mihoyo/bbs/official.ts +++ b/lib/routes/mihoyo/bbs/official.ts @@ -72,5 +72,5 @@ async function handler(ctx) { item: items, }; - ctx.set('data', data); + return data; } diff --git a/lib/routes/mihoyo/bbs/timeline.ts b/lib/routes/mihoyo/bbs/timeline.ts index b7c2b725e7..397e533764 100644 --- a/lib/routes/mihoyo/bbs/timeline.ts +++ b/lib/routes/mihoyo/bbs/timeline.ts @@ -67,5 +67,5 @@ async function handler(ctx) { link, item: items, }; - ctx.set('data', data); + return data; } diff --git a/lib/routes/mihoyo/bbs/user-post.ts b/lib/routes/mihoyo/bbs/user-post.ts index 00365ba6c7..75793a90ff 100644 --- a/lib/routes/mihoyo/bbs/user-post.ts +++ b/lib/routes/mihoyo/bbs/user-post.ts @@ -47,5 +47,5 @@ async function handler(ctx) { link, item: items, }; - ctx.set('data', data); + return data; } diff --git a/lib/routes/newmuseum/exhibitions.ts b/lib/routes/newmuseum/exhibitions.ts index 9c9df292ce..c72aded67f 100644 --- a/lib/routes/newmuseum/exhibitions.ts +++ b/lib/routes/newmuseum/exhibitions.ts @@ -32,18 +32,15 @@ async function handler(ctx) { link = `https://www.newmuseum.org/exhibitions/${state}`; } - ctx.set( - 'data', - await buildData({ - link, - url: link, - title: 'New Museum - Exhibitions', - item: { - item: '.exh', - title: `$('.exh .title').text()`, - link: `$('.exh > a').attr('href')`, - description: `$('.exh .body-reveal').text()`, - }, - }) - ); + return await buildData({ + link, + url: link, + title: 'New Museum - Exhibitions', + item: { + item: '.exh', + title: `$('.exh .title').text()`, + link: `$('.exh > a').attr('href')`, + description: `$('.exh .body-reveal').text()`, + }, + }); } diff --git a/lib/routes/parliament/section77.ts b/lib/routes/parliament/section77.ts index ba55902f11..3e14ee2082 100644 --- a/lib/routes/parliament/section77.ts +++ b/lib/routes/parliament/section77.ts @@ -186,5 +186,5 @@ async function handler(ctx) { result.item = actListFull; - ctx.set('data', result); + return result; } diff --git a/lib/routes/phoronix/index.ts b/lib/routes/phoronix/index.ts index 33cff859ef..7ebb887120 100644 --- a/lib/routes/phoronix/index.ts +++ b/lib/routes/phoronix/index.ts @@ -258,5 +258,5 @@ async function handler(ctx) { ) ); - ctx.set('data', feed); + return feed; } diff --git a/lib/routes/qq/ac/rank.ts b/lib/routes/qq/ac/rank.ts index d3026d4629..cd1d8f32c5 100644 --- a/lib/routes/qq/ac/rank.ts +++ b/lib/routes/qq/ac/rank.ts @@ -45,5 +45,5 @@ async function handler(ctx) { const currentUrl = `${rootUrl}/Rank/comicRank/type/${type}`; - ctx.set('data', await ProcessItems(ctx, currentUrl, time, titles[type])); + return await ProcessItems(ctx, currentUrl, time, titles[type]); } diff --git a/lib/routes/ruancan/category.ts b/lib/routes/ruancan/category.ts index dca50dfb14..2faa3c2802 100644 --- a/lib/routes/ruancan/category.ts +++ b/lib/routes/ruancan/category.ts @@ -28,5 +28,5 @@ async function handler(ctx) { const category = ctx.req.param('category'); const currentUrl = `/cat/${category}`; - ctx.set('data', await fetchFeed(ctx, currentUrl)); + return await fetchFeed(ctx, currentUrl); } diff --git a/lib/routes/ruancan/index.ts b/lib/routes/ruancan/index.ts index d2702b0a54..f4c703c9eb 100644 --- a/lib/routes/ruancan/index.ts +++ b/lib/routes/ruancan/index.ts @@ -16,5 +16,5 @@ export const route: Route = { async function handler(ctx) { const currentUrl = ''; - ctx.set('data', await fetchFeed(ctx, currentUrl)); + return await fetchFeed(ctx, currentUrl); } diff --git a/lib/routes/ruancan/search.ts b/lib/routes/ruancan/search.ts index 367fe198d2..9d2f78ac01 100644 --- a/lib/routes/ruancan/search.ts +++ b/lib/routes/ruancan/search.ts @@ -28,5 +28,5 @@ async function handler(ctx) { const keyword = ctx.req.param('keyword'); const currentUrl = `/?s=${keyword}`; - ctx.set('data', await fetchFeed(ctx, currentUrl)); + return await fetchFeed(ctx, currentUrl); } diff --git a/lib/routes/ruancan/user.ts b/lib/routes/ruancan/user.ts index 7e59bf91d7..00a8f9bad5 100644 --- a/lib/routes/ruancan/user.ts +++ b/lib/routes/ruancan/user.ts @@ -16,5 +16,5 @@ async function handler(ctx) { const id = ctx.req.param('id'); const currentUrl = `/i/${id}`; - ctx.set('data', await fetchFeed(ctx, currentUrl)); + return await fetchFeed(ctx, currentUrl); } diff --git a/lib/routes/sobooks/date.ts b/lib/routes/sobooks/date.ts index 2eb105ea2e..d617042ac9 100644 --- a/lib/routes/sobooks/date.ts +++ b/lib/routes/sobooks/date.ts @@ -26,5 +26,5 @@ export const route: Route = { async function handler(ctx) { const date = ctx.req.param('date') ?? `${new Date().getFullYear()}/${new Date().getMonth()}`; - ctx.set('data', await utils(ctx, `books/date/${date.replace('-', '/')}`)); + return await utils(ctx, `books/date/${date.replace('-', '/')}`); } diff --git a/lib/routes/sobooks/index.ts b/lib/routes/sobooks/index.ts index e308fbcc73..45b1214f79 100644 --- a/lib/routes/sobooks/index.ts +++ b/lib/routes/sobooks/index.ts @@ -36,5 +36,5 @@ export const route: Route = { async function handler(ctx) { const category = ctx.req.param('category') ?? ''; - ctx.set('data', await utils(ctx, category)); + return await utils(ctx, category); } diff --git a/lib/routes/sobooks/tag.ts b/lib/routes/sobooks/tag.ts index 5a10dd1427..fe3f3aadd5 100644 --- a/lib/routes/sobooks/tag.ts +++ b/lib/routes/sobooks/tag.ts @@ -35,5 +35,5 @@ export const route: Route = { async function handler(ctx) { const id = ctx.req.param('id') ?? '小说'; - ctx.set('data', await utils(ctx, `books/tag/${id}`)); + return await utils(ctx, `books/tag/${id}`); } diff --git a/lib/routes/stratechery/index.ts b/lib/routes/stratechery/index.ts index db1d7667c7..d4625b9d44 100644 --- a/lib/routes/stratechery/index.ts +++ b/lib/routes/stratechery/index.ts @@ -8,24 +8,21 @@ export const route: Route = { handler, }; -async function handler(ctx) { +async function handler() { const link = 'https://stratechery.com/'; - ctx.set( - 'data', - await buildData({ - link, - url: link, - title: 'Stratechery by Ben Thompson', - author: 'Ben Thompson', - description: 'Stratechery provides analysis of the strategy and business side of technology and media, and the impact of technology on society. ', - item: { - item: 'article', - title: `$('article > header > h1 > a').text()`, - link: `$('article > header > h1 > a').attr('href')`, - pubDate: `parseDate($('article .entry-date').attr('datetime'))`, - description: `$('article > .entry-content').html().replace(/%/g, '%')`, - }, - }) - ); + return await buildData({ + link, + url: link, + title: 'Stratechery by Ben Thompson', + author: 'Ben Thompson', + description: 'Stratechery provides analysis of the strategy and business side of technology and media, and the impact of technology on society. ', + item: { + item: 'article', + title: `$('article > header > h1 > a').text()`, + link: `$('article > header > h1 > a').attr('href')`, + pubDate: `parseDate($('article .entry-date').attr('datetime'))`, + description: `$('article > .entry-content').html().replace(/%/g, '%')`, + }, + }); } diff --git a/lib/routes/studygolang/go.ts b/lib/routes/studygolang/go.ts index 0df89fc3fb..1daa5af9c6 100644 --- a/lib/routes/studygolang/go.ts +++ b/lib/routes/studygolang/go.ts @@ -23,5 +23,5 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set('data', await FetchGoItems(ctx)); + return await FetchGoItems(ctx); } diff --git a/lib/routes/studygolang/jobs.ts b/lib/routes/studygolang/jobs.ts index 5044654d06..0effa9448c 100644 --- a/lib/routes/studygolang/jobs.ts +++ b/lib/routes/studygolang/jobs.ts @@ -20,5 +20,5 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set('data', await FetchGoItems(ctx, 'jobs')); + return await FetchGoItems(ctx, 'jobs'); } diff --git a/lib/routes/studygolang/weekly.ts b/lib/routes/studygolang/weekly.ts index 8a82783577..8360856503 100644 --- a/lib/routes/studygolang/weekly.ts +++ b/lib/routes/studygolang/weekly.ts @@ -20,5 +20,5 @@ export const route: Route = { }; async function handler(ctx) { - ctx.set('data', await FetchGoItems(ctx, 'weekly')); + return await FetchGoItems(ctx, 'weekly'); } diff --git a/lib/routes/ustb/tj/news.ts b/lib/routes/ustb/tj/news.ts index fd3f658976..c71ef2e087 100644 --- a/lib/routes/ustb/tj/news.ts +++ b/lib/routes/ustb/tj/news.ts @@ -79,5 +79,5 @@ async function handler(ctx) { responseData.item = news; } - ctx.set('data', responseData); + return responseData; } diff --git a/lib/routes/weibo/search/hot.ts b/lib/routes/weibo/search/hot.ts index fc8340548c..8a0efae335 100644 --- a/lib/routes/weibo/search/hot.ts +++ b/lib/routes/weibo/search/hot.ts @@ -93,14 +93,12 @@ async function handler(ctx) { }); } - // Update ctx return { title: '微博热搜榜', link: 'https://s.weibo.com/top/summary?cate=realtimehot', description: '实时热点,每分钟更新一次', item: resultItems, }; - // ctx.set('data', weiboUtils.sinaimgTvax(ctx.state.data)); // no image in the route } async function fetchContent(url) { diff --git a/lib/routes/xunhupay/index.ts b/lib/routes/xunhupay/index.ts index d150e59ed7..71c89dfb7e 100644 --- a/lib/routes/xunhupay/index.ts +++ b/lib/routes/xunhupay/index.ts @@ -24,27 +24,24 @@ export const route: Route = { url: 'www.xunhupay.com/blog', }; -async function handler(ctx) { +async function handler() { const link = `${baseUrl}/blog.html`; - ctx.set( - 'data', - await buildData({ - link, - url: link, - title: `%title%`, - description: `%description%`, - params: { - title: '博客', - description: '虎皮椒-博客', - }, - item: { - item: '.blog-post > article', - title: `$('h5').text()`, - link: `$('a').attr('href')`, - description: `$('.content').text()`, - pubDate: `parseDate($('.date').text(), 'YYYY-MM-DD')`, - guid: Buffer.from(`$('a').attr('href')`).toString('base64'), - }, - }) - ); + return await buildData({ + link, + url: link, + title: `%title%`, + description: `%description%`, + params: { + title: '博客', + description: '虎皮椒-博客', + }, + item: { + item: '.blog-post > article', + title: `$('h5').text()`, + link: `$('a').attr('href')`, + description: `$('.content').text()`, + pubDate: `parseDate($('.date').text(), 'YYYY-MM-DD')`, + guid: Buffer.from(`$('a').attr('href')`).toString('base64'), + }, + }); }