From 46701c20debc10ede0be7e66281fdfd8545e5e26 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Thu, 29 Feb 2024 00:16:32 +0800 Subject: [PATCH] feat: v3 migration - 9/n --- lib/v2/12306/index.js | 4 ++-- lib/v2/aijishu/index.js | 2 +- lib/v2/bloomberg/authors.js | 2 +- lib/v2/bloomberg/index.js | 2 +- lib/v2/cctv/category.js | 4 ++-- lib/v2/cctv/utils/xinwen1j1.js | 4 ++-- lib/v2/coolapk/dyh.js | 2 +- lib/v2/coolapk/hot.js | 2 +- lib/v2/coolapk/huati.js | 2 +- lib/v2/coolapk/toutiao.js | 2 +- lib/v2/coolapk/tuwen.js | 2 +- lib/v2/coolapk/user-dynamic.js | 2 +- lib/v2/dapenti/subject.js | 2 +- lib/v2/dapenti/tugua.js | 2 +- lib/v2/douyin/user.js | 2 +- lib/v2/economist/full.js | 2 +- lib/v2/economist/global-business-review.js | 2 +- lib/v2/feng/forum.js | 6 +++--- lib/v2/feng/utils.js | 4 ++-- lib/v2/gov/ccdi/index.js | 2 +- lib/v2/gov/pbc/gzlw.js | 2 +- lib/v2/iresearch/report.js | 2 +- lib/v2/jike/utils.js | 8 ++++---- lib/v2/mastodon/acct.js | 2 +- lib/v2/nature/highlight.js | 2 +- lib/v2/nature/news-and-comment.js | 2 +- lib/v2/nature/news.js | 2 +- lib/v2/nature/research.js | 2 +- lib/v2/neea/index.js | 2 +- lib/v2/npr/full.js | 2 +- lib/v2/nua/dc.js | 2 +- lib/v2/nua/gra.js | 2 +- lib/v2/nua/index.js | 2 +- lib/v2/nua/lib.js | 2 +- lib/v2/nua/sxw.js | 2 +- lib/v2/sdu/extractor/index.js | 10 +++++----- lib/v2/sdu/wh/jwc.js | 2 +- lib/v2/sdu/wh/news.js | 2 +- lib/v2/theatlantic/news.js | 2 +- lib/v2/wsj/news.js | 2 +- 40 files changed, 53 insertions(+), 53 deletions(-) diff --git a/lib/v2/12306/index.js b/lib/v2/12306/index.js index 2765eed80..1839e7de0 100644 --- a/lib/v2/12306/index.js +++ b/lib/v2/12306/index.js @@ -48,8 +48,8 @@ function getStationInfo(stationName) { module.exports = async (ctx) => { const date = ctx.req.param('date'); - const fromStationInfo = await getStationInfo(ctx.req.param('from'), ctx); - const toStationInfo = await getStationInfo(ctx.req.param('to'), ctx); + const fromStationInfo = await getStationInfo(ctx.req.param('from')); + const toStationInfo = await getStationInfo(ctx.req.param('to')); const type = ctx.req.param('type') ?? 'ADULT'; const apiUrl = `${rootUrl}/otn/leftTicket/queryA?leftTicketDTO.train_date=${date}&leftTicketDTO.from_station=${fromStationInfo.code}&leftTicketDTO.to_station=${toStationInfo.code}&purpose_codes=${type}`; diff --git a/lib/v2/aijishu/index.js b/lib/v2/aijishu/index.js index e2861e0b6..376be57d0 100644 --- a/lib/v2/aijishu/index.js +++ b/lib/v2/aijishu/index.js @@ -16,7 +16,7 @@ module.exports = async (ctx) => { const resp = channel_url_resp.data; const list = resp.data.rows; - const items = await Promise.all(list.filter((item) => item?.url?.startsWith('/a/') || item?.object?.url.startsWith('/a/')).map((item) => utils.parseArticle(item, ctx))); + const items = await Promise.all(list.filter((item) => item?.url?.startsWith('/a/') || item?.object?.url.startsWith('/a/')).map((item) => utils.parseArticle(item))); ctx.set('data', { title: title.split(' - ').slice(0, 2).join(' - '), diff --git a/lib/v2/bloomberg/authors.js b/lib/v2/bloomberg/authors.js index 17299b296..8fa12d08c 100644 --- a/lib/v2/bloomberg/authors.js +++ b/lib/v2/bloomberg/authors.js @@ -40,7 +40,7 @@ module.exports = async (ctx) => { list = (await rssParser.parseURL(`${link}.rss`)).items; } - const item = await asyncPoolAll(1, list, (item) => parseArticle(item, ctx)); + const item = await asyncPoolAll(1, list, (item) => parseArticle(item)); const authorName = item.find((i) => i.author)?.author ?? 'Unknown'; ctx.set('data', { diff --git a/lib/v2/bloomberg/index.js b/lib/v2/bloomberg/index.js index 250ae7af3..1fb90908e 100644 --- a/lib/v2/bloomberg/index.js +++ b/lib/v2/bloomberg/index.js @@ -19,7 +19,7 @@ module.exports = async (ctx) => { const currentUrl = site ? `${rootUrl}/${site}/sitemap_news.xml` : `${rootUrl}/sitemap_news.xml`; const list = await parseNewsList(currentUrl, ctx); - const items = await asyncPoolAll(1, list, (item) => parseArticle(item, ctx)); + const items = await asyncPoolAll(1, list, (item) => parseArticle(item)); ctx.set('data', { title: `Bloomberg - ${site_title_mapping[site ?? '/']}`, link: currentUrl, diff --git a/lib/v2/cctv/category.js b/lib/v2/cctv/category.js index 7429cebd2..75f1c7e7f 100644 --- a/lib/v2/cctv/category.js +++ b/lib/v2/cctv/category.js @@ -9,11 +9,11 @@ module.exports = async (ctx) => { } else if (category === 'xinwen1j1') { // 新闻1+1 const xinwen1j1 = require('./utils/xinwen1j1'); - responseData = await xinwen1j1(ctx); + responseData = await xinwen1j1(); } else { // 央视新闻 const getNews = require('./utils/news'); - responseData = await getNews(category, ctx); + responseData = await getNews(category); } ctx.set('data', responseData); diff --git a/lib/v2/cctv/utils/xinwen1j1.js b/lib/v2/cctv/utils/xinwen1j1.js index b5531c18d..288d637d9 100644 --- a/lib/v2/cctv/utils/xinwen1j1.js +++ b/lib/v2/cctv/utils/xinwen1j1.js @@ -53,7 +53,7 @@ const ProcessFeed = (data) => return { ...single, ...other }; }) ); -module.exports = async (ctx) => { +module.exports = async () => { const baseUrl = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?id=TOPC1451559066181661&n=20&sort=desc&p=1&mode=0&serviceId=tvcctv'; // 获取要处理的页面 const res = await got({ @@ -70,7 +70,7 @@ module.exports = async (ctx) => { // $('div.image').slice(0,3).find('a').attr('href').split('?')[0] // 处理所有的页面 - const result = await ProcessFeed(data, ctx); + const result = await ProcessFeed(data); return { title: '《新闻1+1》- 中央电视台新闻频道', diff --git a/lib/v2/coolapk/dyh.js b/lib/v2/coolapk/dyh.js index afc1f2e25..a69b8abdf 100644 --- a/lib/v2/coolapk/dyh.js +++ b/lib/v2/coolapk/dyh.js @@ -20,7 +20,7 @@ module.exports = async (ctx) => { targetTitle = item.targetRow.title; } - return utils.parseDynamic(item, ctx); + return utils.parseDynamic(item); }) ); diff --git a/lib/v2/coolapk/hot.js b/lib/v2/coolapk/hot.js index 83988e9cb..74ed06b68 100644 --- a/lib/v2/coolapk/hot.js +++ b/lib/v2/coolapk/hot.js @@ -84,7 +84,7 @@ module.exports = async (ctx) => { } } - let out = await Promise.all(t.map((item) => utils.parseDynamic(item, ctx))); + let out = await Promise.all(t.map((item) => utils.parseDynamic(item))); out = out.filter(Boolean); diff --git a/lib/v2/coolapk/huati.js b/lib/v2/coolapk/huati.js index f128d2d48..f718cbb1a 100644 --- a/lib/v2/coolapk/huati.js +++ b/lib/v2/coolapk/huati.js @@ -9,7 +9,7 @@ module.exports = async (ctx) => { }); const data = response.data.data; - let out = await Promise.all(data.map((item) => utils.parseDynamic(item, ctx))); + let out = await Promise.all(data.map((item) => utils.parseDynamic(item))); out = out.filter(Boolean); // 去除空值 if (out.length === 0) { diff --git a/lib/v2/coolapk/toutiao.js b/lib/v2/coolapk/toutiao.js index 10999233b..fac7fb1a6 100644 --- a/lib/v2/coolapk/toutiao.js +++ b/lib/v2/coolapk/toutiao.js @@ -18,7 +18,7 @@ module.exports = async (ctx) => { }); const data = response.data.data; - const out = await Promise.all(data.map((item) => utils.parseDynamic(item, ctx))); + const out = await Promise.all(data.map((item) => utils.parseDynamic(item))); ctx.set('data', { title: urls[type].title, diff --git a/lib/v2/coolapk/tuwen.js b/lib/v2/coolapk/tuwen.js index 0a162f56a..9486a9c06 100644 --- a/lib/v2/coolapk/tuwen.js +++ b/lib/v2/coolapk/tuwen.js @@ -20,7 +20,7 @@ module.exports = async (ctx) => { }); const data = response.data.data; - const out = await Promise.all(data.map((item) => utils.parseDynamic(item, ctx))); + const out = await Promise.all(data.map((item) => utils.parseDynamic(item))); ctx.set('data', { title: feedTitle, diff --git a/lib/v2/coolapk/user-dynamic.js b/lib/v2/coolapk/user-dynamic.js index 920aa4ff4..ad5f6eb97 100644 --- a/lib/v2/coolapk/user-dynamic.js +++ b/lib/v2/coolapk/user-dynamic.js @@ -18,7 +18,7 @@ module.exports = async (ctx) => { username = item.username; } - return utils.parseDynamic(item, ctx); + return utils.parseDynamic(item); }) ); diff --git a/lib/v2/dapenti/subject.js b/lib/v2/dapenti/subject.js index 89021bc38..981bc29b6 100644 --- a/lib/v2/dapenti/subject.js +++ b/lib/v2/dapenti/subject.js @@ -1,5 +1,5 @@ const utils = require('./utils'); module.exports = async (ctx) => { - ctx.set('data', await utils.parseFeed({ subjectid: ctx.req.param('id') }, ctx)); + ctx.set('data', await utils.parseFeed({ subjectid: ctx.req.param('id') })); }; diff --git a/lib/v2/dapenti/tugua.js b/lib/v2/dapenti/tugua.js index 6c7730ae3..d16a816d3 100644 --- a/lib/v2/dapenti/tugua.js +++ b/lib/v2/dapenti/tugua.js @@ -1,5 +1,5 @@ const utils = require('./utils'); module.exports = async (ctx) => { - ctx.set('data', await utils.parseFeed({ subjectid: 70 }, ctx)); + ctx.set('data', await utils.parseFeed({ subjectid: 70 })); }; diff --git a/lib/v2/douyin/user.js b/lib/v2/douyin/user.js index cfaebbe28..2c0468e75 100644 --- a/lib/v2/douyin/user.js +++ b/lib/v2/douyin/user.js @@ -20,7 +20,7 @@ module.exports = async (ctx) => { const pageData = await cache.tryGet( `douyin:user:${uid}`, async () => { - const renderData = await universalGet(pageUrl, 'user', ctx); + const renderData = await universalGet(pageUrl, 'user'); const dataKey = Object.keys(renderData).find((key) => renderData[key].user && renderData[key].post); return renderData[dataKey]; }, diff --git a/lib/v2/economist/full.js b/lib/v2/economist/full.js index c82debfa1..bd890625a 100644 --- a/lib/v2/economist/full.js +++ b/lib/v2/economist/full.js @@ -26,7 +26,7 @@ module.exports = async (ctx) => { feed.items.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30).map(async (item) => { const path = item.link.slice(item.link.lastIndexOf('/') + 1); const isNotCollection = !/^\d{4}-\d{2}-\d{2}$/.test(path); - const itemDetails = isNotCollection ? await getArticleDetail(item.link, ctx) : null; + const itemDetails = isNotCollection ? await getArticleDetail(item.link) : null; return { title: item.title, description: isNotCollection ? itemDetails.article : item.content, diff --git a/lib/v2/economist/global-business-review.js b/lib/v2/economist/global-business-review.js index d34280678..e5ec4ad9d 100644 --- a/lib/v2/economist/global-business-review.js +++ b/lib/v2/economist/global-business-review.js @@ -81,7 +81,7 @@ module.exports = async (ctx) => { const items = await Promise.all( response.data.articles.new.slice(0, ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10).map(async (item) => ({ title: parseTitle(item.body.title, [main_language]), - description: await getArticleDetail(item.article_id, language, ctx), + description: await getArticleDetail(item.article_id, language), category: parseTitle(item.body.fly_title, [main_language]), link: `https://www.businessreview.global/latest/${item.article_id}`, pubDate: item.publication_date, diff --git a/lib/v2/feng/forum.js b/lib/v2/feng/forum.js index 307533f59..fc146a7cb 100644 --- a/lib/v2/feng/forum.js +++ b/lib/v2/feng/forum.js @@ -7,9 +7,9 @@ module.exports = async (ctx) => { const topicId = Number(ctx.req.param('id')); const { type = 'all' } = ctx.params; - const forumMeta = await getForumMeta(topicId, ctx); + const forumMeta = await getForumMeta(topicId); const topicMeta = forumMeta.dataList.find((data) => data.topicId === topicId); - const threads = (await getThreads(topicId, type, ctx)).data.dataList.map((data) => ({ + const threads = (await getThreads(topicId, type)).data.dataList.map((data) => ({ title: data.title, pubDate: parseDate(data.dateline * 1000), author: data.userBaseInfo.userName, @@ -19,7 +19,7 @@ module.exports = async (ctx) => { const posts = await Promise.all( threads.map(async (item) => { - const thread = await getThread(item.tid, topicId, ctx); + const thread = await getThread(item.tid, topicId); if (thread.status.code === 0) { const img = art(path.join(__dirname, 'templates/img.art'), { images: thread.data.thread.fengTalkImage.length ? thread.data.thread.fengTalkImage : undefined, diff --git a/lib/v2/feng/utils.js b/lib/v2/feng/utils.js index 7ff08f71e..a10334e2d 100644 --- a/lib/v2/feng/utils.js +++ b/lib/v2/feng/utils.js @@ -37,8 +37,8 @@ const getCategory = (topicId) => { ); }; -const getForumMeta = async (topicId, ctx) => { - const categoryData = await getCategory(topicId, ctx); +const getForumMeta = async (topicId) => { + const categoryData = await getCategory(topicId); return Object.values(categoryData.data.dataList).find((item) => item.dataList.find((i) => i.topicId === topicId)); }; diff --git a/lib/v2/gov/ccdi/index.js b/lib/v2/gov/ccdi/index.js index b7b8a6dd2..bf74d4702 100644 --- a/lib/v2/gov/ccdi/index.js +++ b/lib/v2/gov/ccdi/index.js @@ -8,7 +8,7 @@ module.exports = async (ctx) => { const currentUrl = `${rootUrl}${pathname}`; const { list, title } = await parseNewsList(currentUrl, '.list_news_dl2 li', ctx); - const items = await Promise.all(list.map((item) => parseArticle(item, ctx))); + const items = await Promise.all(list.map((item) => parseArticle(item))); ctx.set('data', { title, diff --git a/lib/v2/gov/pbc/gzlw.js b/lib/v2/gov/pbc/gzlw.js index 0e71887ba..6a5cc29c5 100644 --- a/lib/v2/gov/pbc/gzlw.js +++ b/lib/v2/gov/pbc/gzlw.js @@ -17,7 +17,7 @@ module.exports = async (ctx) => { })) .get(); - const items = await processItems(list, ctx); + const items = await processItems(list); ctx.set('data', { title: '中国人民银行 工作论文', diff --git a/lib/v2/iresearch/report.js b/lib/v2/iresearch/report.js index dbcf5d9a4..de03d5e62 100644 --- a/lib/v2/iresearch/report.js +++ b/lib/v2/iresearch/report.js @@ -46,7 +46,7 @@ module.exports = async (ctx) => { const items = await Promise.all( list.map(async (item) => ({ title: item.Title, - description: await processReport(item, ctx), + description: await processReport(item), pubDate: timezone(parseDate(item.Uptime), +8), link: item.VisitUrl, })) diff --git a/lib/v2/jike/utils.js b/lib/v2/jike/utils.js index 2be411bc6..9d1367fe4 100644 --- a/lib/v2/jike/utils.js +++ b/lib/v2/jike/utils.js @@ -177,21 +177,21 @@ module.exports = { ); if (data.length === 0) { - ctx.state.data = { + ctx.set('data', { title: '主题 ID 不存在,或该主题暂无内容', - }; + }); return null; } const topic = data.topic; - ctx.state.data = { + ctx.set('data', { title: `${topic.content} - 即刻圈子`, link: url, description: topic.briefIntro, image: topic.squarePicture.picUrl || topic.squarePicture.middlePicUrl || topic.squarePicture.thumbnailUrl, // item: topicDataHanding(data), - }; + }); return data; }, diff --git a/lib/v2/mastodon/acct.js b/lib/v2/mastodon/acct.js index 2f6ff7070..e3f5e07f9 100644 --- a/lib/v2/mastodon/acct.js +++ b/lib/v2/mastodon/acct.js @@ -4,7 +4,7 @@ module.exports = async (ctx) => { const acct = ctx.req.param('acct'); const only_media = ctx.req.param('only_media') ? 'true' : 'false'; - const { site, account_id } = await utils.getAccountIdByAcct(acct, ctx); + const { site, account_id } = await utils.getAccountIdByAcct(acct); const { account_data, data } = await utils.getAccountStatuses(site, account_id, only_media); diff --git a/lib/v2/nature/highlight.js b/lib/v2/nature/highlight.js index 57f39c92b..b381149dc 100644 --- a/lib/v2/nature/highlight.js +++ b/lib/v2/nature/highlight.js @@ -11,7 +11,7 @@ module.exports = async (ctx) => { let items = getArticleList($); - items = await Promise.all(items.map((item) => getArticle(item, ctx))); + items = await Promise.all(items.map((item) => getArticle(item))); ctx.set('data', { title: $('title').text().trim(), diff --git a/lib/v2/nature/news-and-comment.js b/lib/v2/nature/news-and-comment.js index 254e9a15b..438bc4c43 100644 --- a/lib/v2/nature/news-and-comment.js +++ b/lib/v2/nature/news-and-comment.js @@ -26,7 +26,7 @@ module.exports = async (ctx) => { let items = getArticleList(pageCapture); - items = await Promise.all(items.map((item) => getArticle(item, ctx))); + items = await Promise.all(items.map((item) => getArticle(item))); ctx.set('data', { title: pageCapture('title').text(), diff --git a/lib/v2/nature/news.js b/lib/v2/nature/news.js index 9e1761b54..ce0b894aa 100644 --- a/lib/v2/nature/news.js +++ b/lib/v2/nature/news.js @@ -20,7 +20,7 @@ module.exports = async (ctx) => { }; }); - items = await Promise.all(items.map((item) => cache.tryGet(item.link, () => getArticle(item, ctx)))); + items = await Promise.all(items.map((item) => cache.tryGet(item.link, () => getArticle(item)))); ctx.set('data', { title: 'Nature | Latest News', diff --git a/lib/v2/nature/research.js b/lib/v2/nature/research.js index 46ce6a385..c4f948cd9 100644 --- a/lib/v2/nature/research.js +++ b/lib/v2/nature/research.js @@ -28,7 +28,7 @@ module.exports = async (ctx) => { let items = getArticleList(pageCapture); - items = await Promise.all(items.map((item) => getArticle(item, ctx))); + items = await Promise.all(items.map((item) => getArticle(item))); ctx.set('data', { title: `Nature (${pageTitle}) | Latest Research`, diff --git a/lib/v2/neea/index.js b/lib/v2/neea/index.js index c5b717ce4..db1aa3850 100644 --- a/lib/v2/neea/index.js +++ b/lib/v2/neea/index.js @@ -44,7 +44,7 @@ module.exports = async (ctx) => { guid: itemUrl, pubDate: new Date(time).toUTCString(), }; - const other = await loadContent(String(itemUrl), ctx); + const other = await loadContent(String(itemUrl)); return Object.assign({}, single, other); }) ); diff --git a/lib/v2/npr/full.js b/lib/v2/npr/full.js index f9d2ede7d..ac217ad5a 100644 --- a/lib/v2/npr/full.js +++ b/lib/v2/npr/full.js @@ -65,7 +65,7 @@ module.exports = async (ctx) => { const items = ( await Promise.all( feed.items.map(async (item) => { - const itemDetails = await getArticleDetail(item.link, ctx); + const itemDetails = await getArticleDetail(item.link); if (itemDetails === null) { return null; } diff --git a/lib/v2/nua/dc.js b/lib/v2/nua/dc.js index e9021880d..033afe10c 100644 --- a/lib/v2/nua/dc.js +++ b/lib/v2/nua/dc.js @@ -52,7 +52,7 @@ module.exports = async (ctx) => { } const items = await util.ProcessList(baseUrl, baseUrl, listName, listDate, webPageName); - const results = await util.ProcessFeed(items[0], artiContent, ctx); + const results = await util.ProcessFeed(items[0], artiContent); ctx.set('data', { title: 'NUA-设计学院-' + items[1], diff --git a/lib/v2/nua/gra.js b/lib/v2/nua/gra.js index a5a5dc009..15d2023c5 100644 --- a/lib/v2/nua/gra.js +++ b/lib/v2/nua/gra.js @@ -10,7 +10,7 @@ module.exports = async (ctx) => { const webPageName = '.col_title'; const items = await util.ProcessList(newsUrl, baseUrl, listName, listDate, webPageName); - const results = await util.ProcessFeed(items[0], artiContent, ctx); + const results = await util.ProcessFeed(items[0], artiContent); ctx.set('data', { title: 'NUA-研究生处-' + items[1], diff --git a/lib/v2/nua/index.js b/lib/v2/nua/index.js index 868ab837b..7a684b506 100644 --- a/lib/v2/nua/index.js +++ b/lib/v2/nua/index.js @@ -11,7 +11,7 @@ module.exports = async (ctx) => { const artiContent = '.read'; const items = await util.ProcessList(newsUrl, baseUrl, listName, listDate, webPageName); - const results = await util.ProcessFeed(items[0], artiContent, ctx); + const results = await util.ProcessFeed(items[0], artiContent); ctx.set('data', { title: 'NUA-' + items[1], diff --git a/lib/v2/nua/lib.js b/lib/v2/nua/lib.js index 2a08f89d9..f8fe85528 100644 --- a/lib/v2/nua/lib.js +++ b/lib/v2/nua/lib.js @@ -28,7 +28,7 @@ module.exports = async (ctx) => { const listDate = '.news_date'; const items = await util.ProcessList(newsUrl, baseUrl, listName, listDate, webPageName); - const results = await util.ProcessFeed(items[0], artiContent, ctx); + const results = await util.ProcessFeed(items[0], artiContent); ctx.set('data', { title: 'NUA-图书馆-' + items[1], diff --git a/lib/v2/nua/sxw.js b/lib/v2/nua/sxw.js index e5662eb9d..8f3bc9b1d 100644 --- a/lib/v2/nua/sxw.js +++ b/lib/v2/nua/sxw.js @@ -11,7 +11,7 @@ module.exports = async (ctx) => { const artiContent = '.read'; const items = await util.ProcessList(newsUrl, baseUrl, listName, listDate, webPageName); - const results = await util.ProcessFeed(items[0], artiContent, ctx); + const results = await util.ProcessFeed(items[0], artiContent); ctx.set('data', { title: 'NUA-双馨网-' + items[1], diff --git a/lib/v2/sdu/extractor/index.js b/lib/v2/sdu/extractor/index.js index 13861ac1b..5e9652ae5 100644 --- a/lib/v2/sdu/extractor/index.js +++ b/lib/v2/sdu/extractor/index.js @@ -1,15 +1,15 @@ -module.exports = (link, ctx) => { +module.exports = (link) => { if (link.startsWith('https://xinwen.wh.sdu.edu.cn/')) { - return require('./wh/news')(link, ctx); + return require('./wh/news')(link); } if (link.startsWith('https://www.view.sdu.edu.cn/')) { - return require('./view')(link, ctx); + return require('./view')(link); } if (link.startsWith('https://www.sdrj.sdu.edu.cn/')) { - return require('./sdrj')(link, ctx); + return require('./sdrj')(link); } if (link.startsWith('https://jwc.wh.sdu.edu.cn/')) { - return require('./wh/jwc')(link, ctx); + return require('./wh/jwc')(link); } return {}; }; diff --git a/lib/v2/sdu/wh/jwc.js b/lib/v2/sdu/wh/jwc.js index f744df42f..61828cce9 100644 --- a/lib/v2/sdu/wh/jwc.js +++ b/lib/v2/sdu/wh/jwc.js @@ -22,7 +22,7 @@ module.exports = async (ctx) => { const href = anchor.attr('href'); const link = href.startsWith('http') ? href : baseUrl + href; const title = item.text(); - const { description, author: exactAuthor, exactDate } = await cache.tryGet(link, () => extractor(link, ctx)); + const { description, author: exactAuthor, exactDate } = await cache.tryGet(link, () => extractor(link)); const author = exactAuthor ?? '教务处'; const pubDate = exactDate ?? timezone(parseDate(dateText.slice(1, -1), 'YYYY-MM-DD'), +8); return { diff --git a/lib/v2/sdu/wh/news.js b/lib/v2/sdu/wh/news.js index 4efa829d1..01980e08b 100644 --- a/lib/v2/sdu/wh/news.js +++ b/lib/v2/sdu/wh/news.js @@ -18,7 +18,7 @@ module.exports = async (ctx) => { const title = anchor.attr('title'); const href = anchor.attr('href'); const link = href.startsWith('http') ? href : baseUrl + href; - const { description, author, exactDate } = await cache.tryGet(link, () => extractor(link, ctx)); + const { description, author, exactDate } = await cache.tryGet(link, () => extractor(link)); const span = item.find('span'); const pubDate = exactDate ?? parseDate(span.text(), 'YYYY/MM/DD'); return { diff --git a/lib/v2/theatlantic/news.js b/lib/v2/theatlantic/news.js index e998e0f5c..12976d99b 100644 --- a/lib/v2/theatlantic/news.js +++ b/lib/v2/theatlantic/news.js @@ -21,7 +21,7 @@ module.exports = async (ctx) => { data.pubDate = item.node.datePublished; return data; }); - const items = await getArticleDetails(list, ctx); + const items = await getArticleDetails(list); ctx.set('data', { title: `The Atlantic - ${category.toUpperCase()}`, diff --git a/lib/v2/wsj/news.js b/lib/v2/wsj/news.js index 151fbbe2c..1f7557ea7 100644 --- a/lib/v2/wsj/news.js +++ b/lib/v2/wsj/news.js @@ -40,7 +40,7 @@ module.exports = async (ctx) => { item.test = key; return item; }); - const items = await asyncPoolAll(10, list, (item) => parseArticle(item, ctx)); + const items = await asyncPoolAll(10, list, (item) => parseArticle(item)); ctx.set('data', { title: `WSJ${subTitle}`,