diff --git a/lib/routes/cneb/guoneinews.js b/lib/routes/cneb/guoneinews.js index 8533183de2..8c11c6a0d1 100644 --- a/lib/routes/cneb/guoneinews.js +++ b/lib/routes/cneb/guoneinews.js @@ -1,10 +1,12 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { - const list = (await got({ - method: 'get', - url: 'http://www.cneb.gov.cn/guoneinews/guoneidata/', - })).data.rollData; + const list = ( + await got({ + method: 'get', + url: 'http://www.cneb.gov.cn/guoneinews/guoneidata/', + }) + ).data.rollData; const items = list.map((item) => { const single = { diff --git a/lib/routes/cneb/yjxx.js b/lib/routes/cneb/yjxx.js index 177e37d16f..38d8ada1f3 100644 --- a/lib/routes/cneb/yjxx.js +++ b/lib/routes/cneb/yjxx.js @@ -1,10 +1,12 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { - const warningMessagesJsonp = (await got({ - method: 'get', - url: 'http://uc.cneb.gov.cn:8080/getWarningMessages?callback=func&start=0&pagetype=PAGE1409368873582889&rows=100&_=' + +new Date(), - })).data.trim(); + const warningMessagesJsonp = ( + await got({ + method: 'get', + url: 'http://uc.cneb.gov.cn:8080/getWarningMessages?callback=func&start=0&pagetype=PAGE1409368873582889&rows=100&_=' + +new Date(), + }) + ).data.trim(); let warningMessages = []; diff --git a/lib/routes/eleme/open-be/announce.js b/lib/routes/eleme/open-be/announce.js index 7286c063a5..2df6e3b82e 100644 --- a/lib/routes/eleme/open-be/announce.js +++ b/lib/routes/eleme/open-be/announce.js @@ -1,10 +1,12 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { - const data = (await got({ - method: 'get', - url: 'https://open-be.ele.me/dev/notice/list?curpage=1&perpage=200', - })).data; + const data = ( + await got({ + method: 'get', + url: 'https://open-be.ele.me/dev/notice/list?curpage=1&perpage=200', + }) + ).data; ctx.state.data = { title: '饿百零售开放平台-公告', diff --git a/lib/routes/eleme/open/announce.js b/lib/routes/eleme/open/announce.js index dffdd94739..18c762fb02 100644 --- a/lib/routes/eleme/open/announce.js +++ b/lib/routes/eleme/open/announce.js @@ -1,25 +1,27 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { - const data = (await got({ - method: 'post', - url: 'https://app-api.shop.ele.me/arena/invoke/?method=NoticeKeeperService.getBroadcastList', - json: true, - data: { - id: '5CC2B32FA6F24CF78CB300DDE2F370BE|1565511577423', - metas: { - appName: 'Odin', - appVersion: '4.4.0', + const data = ( + await got({ + method: 'post', + url: 'https://app-api.shop.ele.me/arena/invoke/?method=NoticeKeeperService.getBroadcastList', + json: true, + data: { + id: '5CC2B32FA6F24CF78CB300DDE2F370BE|1565511577423', + metas: { + appName: 'Odin', + appVersion: '4.4.0', + }, + service: 'NoticeKeeperService', + method: 'getBroadcastList', + params: { + offset: 0, + limit: 999, + }, + ncp: '2.0.0', }, - service: 'NoticeKeeperService', - method: 'getBroadcastList', - params: { - offset: 0, - limit: 999, - }, - ncp: '2.0.0', - }, - })).data; + }) + ).data; ctx.state.data = { title: '饿了么商家开放平台-公告', diff --git a/lib/routes/enclavebooks/category.js b/lib/routes/enclavebooks/category.js index 2df4c47d74..e7c644f0f0 100644 --- a/lib/routes/enclavebooks/category.js +++ b/lib/routes/enclavebooks/category.js @@ -4,13 +4,15 @@ const host = 'https://www.enclavebooks.cn'; module.exports = async (ctx) => { const id = ctx.params.id; - const categorys = (await got({ - method: 'get', - url: 'https://app.enclavebooks.cn/v2/discovery', - headers: { - Referer: host, - }, - })).data.result.category; + const categorys = ( + await got({ + method: 'get', + url: 'https://app.enclavebooks.cn/v2/discovery', + headers: { + Referer: host, + }, + }) + ).data.result.category; let category_name, description; for (let i = 0; i < categorys.length; i++) { @@ -22,13 +24,15 @@ module.exports = async (ctx) => { } } - const list = (await got({ - method: 'get', - url: `https://app.enclavebooks.cn/v1_9/getCategoryList?cateId=${id}&page=1`, - headers: { - Referer: host, - }, - })).data.result.data; + const list = ( + await got({ + method: 'get', + url: `https://app.enclavebooks.cn/v1_9/getCategoryList?cateId=${id}&page=1`, + headers: { + Referer: host, + }, + }) + ).data.result.data; const out = await Promise.all( list.map(async (item) => { diff --git a/lib/routes/instagram/story.js b/lib/routes/instagram/story.js index 5095f3f17d..30ee95baa8 100644 --- a/lib/routes/instagram/story.js +++ b/lib/routes/instagram/story.js @@ -3,13 +3,15 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { const username = ctx.params.username; - const response = (await got({ - method: 'get', - url: `https://api.storiesig.com/stories/${username}`, - headers: { - Referer: `https://storiesig.com/?username=${username}`, - }, - })).data; + const response = ( + await got({ + method: 'get', + url: `https://api.storiesig.com/stories/${username}`, + headers: { + Referer: `https://storiesig.com/?username=${username}`, + }, + }) + ).data; const items = response.items.map((item) => { const image = item.image_versions2 && item.image_versions2.candidates[0].url; diff --git a/lib/routes/juejin/pins.js b/lib/routes/juejin/pins.js index 711633639e..6e4a55e645 100644 --- a/lib/routes/juejin/pins.js +++ b/lib/routes/juejin/pins.js @@ -11,36 +11,42 @@ module.exports = async (ctx) => { }, }); - const items = response.data.data.recommendedActivityFeed.items.edges.map(({ node: { targets: [item] } }) => { - const content = item.content; - const title = content; - const guid = item.id; - const link = `https://juejin.im/pin/${guid}`; - const pubDate = new Date(item.createdAt).toUTCString(); - const author = item.user.username; - const imgs = item.pictures.reduce((imgs, item) => { - imgs += ` + const items = response.data.data.recommendedActivityFeed.items.edges.map( + ({ + node: { + targets: [item], + }, + }) => { + const content = item.content; + const title = content; + const guid = item.id; + const link = `https://juejin.im/pin/${guid}`; + const pubDate = new Date(item.createdAt).toUTCString(); + const author = item.user.username; + const imgs = item.pictures.reduce((imgs, item) => { + imgs += `
`; - return imgs; - }, ''); - const url = item.url; - const urlTitle = item.urlTitle; - const description = ` + return imgs; + }, ''); + const url = item.url; + const urlTitle = item.urlTitle; + const description = ` ${content.replace(/\n/g, '
')}
${imgs}
${urlTitle}
`; - return { - title, - link, - description, - guid, - pubDate, - author, - }; - }); + return { + title, + link, + description, + guid, + pubDate, + author, + }; + } + ); ctx.state.data = { title: '沸点 - 动态', diff --git a/lib/routes/netease/dy.js b/lib/routes/netease/dy.js index f1840c9621..064cd62135 100644 --- a/lib/routes/netease/dy.js +++ b/lib/routes/netease/dy.js @@ -19,9 +19,11 @@ module.exports = async (ctx) => { const response = await ctx.cache.tryGet( e.link, async () => - (await got.get(e.link, { - responseType: 'buffer', - })).data + ( + await got.get(e.link, { + responseType: 'buffer', + }) + ).data ); const html = iconv.decode(response, 'gbk'); const $ = cheerio.load(html, { decodeEntities: false }); diff --git a/lib/routes/sf/sffq-announce.js b/lib/routes/sf/sffq-announce.js index a605be5d06..fcf1fb9c92 100644 --- a/lib/routes/sf/sffq-announce.js +++ b/lib/routes/sf/sffq-announce.js @@ -1,12 +1,14 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { - const data = (await got({ - method: 'post', - url: 'https://qiao.sf-express.com/menu/getListNews.pub', - json: true, - data: {}, - })).data; + const data = ( + await got({ + method: 'post', + url: 'https://qiao.sf-express.com/menu/getListNews.pub', + json: true, + data: {}, + }) + ).data; ctx.state.data = { title: '顺丰丰桥开放平台-公告', diff --git a/lib/routes/tencent/news/author.js b/lib/routes/tencent/news/author.js index 03b870a3ff..78bde8d5e6 100644 --- a/lib/routes/tencent/news/author.js +++ b/lib/routes/tencent/news/author.js @@ -29,9 +29,11 @@ module.exports = async (ctx) => { const response = await ctx.cache.tryGet( itemUrl, async () => - (await got.get(itemUrl, { - responseType: 'buffer', - })).data + ( + await got.get(itemUrl, { + responseType: 'buffer', + }) + ).data ); const html = iconv.decode(response, 'gbk'); const $ = cheerio.load(html, { decodeEntities: false }); diff --git a/lib/routes/universities/njust/cwc/index.js b/lib/routes/universities/njust/cwc/index.js index 3948461522..3bcb887b41 100644 --- a/lib/routes/universities/njust/cwc/index.js +++ b/lib/routes/universities/njust/cwc/index.js @@ -4,7 +4,10 @@ const url = require('url'); const host = 'http://cwc.njust.edu.cn/'; -const map = new Map([[1, { title: '南京理工大学财务处 -- 新闻及通知', id: 'wp_news_w2' }], [2, { title: '南京理工大学财务处 -- 办事指南', id: 'wp_news_w3' }]]); +const map = new Map([ + [1, { title: '南京理工大学财务处 -- 新闻及通知', id: 'wp_news_w2' }], + [2, { title: '南京理工大学财务处 -- 办事指南', id: 'wp_news_w3' }], +]); module.exports = async (ctx) => { const type = Number.parseInt(ctx.params.type); diff --git a/lib/routes/universities/njust/gs/index.js b/lib/routes/universities/njust/gs/index.js index ca87f60100..03261bdc82 100644 --- a/lib/routes/universities/njust/gs/index.js +++ b/lib/routes/universities/njust/gs/index.js @@ -1,7 +1,10 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); -const map = new Map([[1, { title: '南京理工大学研究生院 -- 通知公告', id: '/sytzgg_4568' }], [2, { title: '南京理工大学研究生院 -- 学术公告', id: '/xshdggl' }]]); +const map = new Map([ + [1, { title: '南京理工大学研究生院 -- 通知公告', id: '/sytzgg_4568' }], + [2, { title: '南京理工大学研究生院 -- 学术公告', id: '/xshdggl' }], +]); module.exports = async (ctx) => { const type = Number.parseInt(ctx.params.type); diff --git a/lib/routes/universities/swufe/seie/index.js b/lib/routes/universities/swufe/seie/index.js index 7950bf2db4..a9c93fd013 100644 --- a/lib/routes/universities/swufe/seie/index.js +++ b/lib/routes/universities/swufe/seie/index.js @@ -5,7 +5,10 @@ const url = require('url'); const listUrl = 'https://it.swufe.edu.cn/index/'; const baseUrl = 'https://it.swufe.edu.cn/'; -const map = new Map([['xyxw', { title: '西南财经大学经济信息工程学院 -- 学院新闻', suffix: 'xyxw.htm' }], ['tzgg', { title: '西南财经大学经济信息工程学院 -- 通知公告', suffix: 'tzgg.htm' }]]); +const map = new Map([ + ['xyxw', { title: '西南财经大学经济信息工程学院 -- 学院新闻', suffix: 'xyxw.htm' }], + ['tzgg', { title: '西南财经大学经济信息工程学院 -- 通知公告', suffix: 'tzgg.htm' }], +]); module.exports = async (ctx) => { const type = ctx.params.type || 'tzgg'; diff --git a/lib/routes/universities/szu/yz/index.js b/lib/routes/universities/szu/yz/index.js index 3f9242058b..0a16303088 100644 --- a/lib/routes/universities/szu/yz/index.js +++ b/lib/routes/universities/szu/yz/index.js @@ -2,7 +2,10 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); const util = require('./utils'); -const map = new Map([[1, { title: '硕士招生 - 深圳大学研究生招生网' }], [2, { title: '博士招生 - 深圳大学研究生招生网' }]]); +const map = new Map([ + [1, { title: '硕士招生 - 深圳大学研究生招生网' }], + [2, { title: '博士招生 - 深圳大学研究生招生网' }], +]); module.exports = async (ctx) => { let type = Number.parseInt(ctx.params.type); diff --git a/lib/routes/vocus/user.js b/lib/routes/vocus/user.js index 4bd5a55bdd..b16c0385a7 100644 --- a/lib/routes/vocus/user.js +++ b/lib/routes/vocus/user.js @@ -5,21 +5,25 @@ module.exports = async (ctx) => { const id = ctx.params.id; const link = `https://vocus.cc/user/@${id}`; - const { _id, fullname, intro } = (await got({ - method: 'get', - url: `https://api.sosreader.com/api/users/${id}`, - headers: { - Referer: link, - }, - })).data; + const { _id, fullname, intro } = ( + await got({ + method: 'get', + url: `https://api.sosreader.com/api/users/${id}`, + headers: { + Referer: link, + }, + }) + ).data; - const { articles } = (await got({ - method: 'get', - url: `https://api.sosreader.com/api/articles?userId=${_id}&num=10&status=2&sort=lastPublishAt`, - headers: { - Referer: link, - }, - })).data; + const { articles } = ( + await got({ + method: 'get', + url: `https://api.sosreader.com/api/articles?userId=${_id}&num=10&status=2&sort=lastPublishAt`, + headers: { + Referer: link, + }, + }) + ).data; const items = await ProcessFeed(articles, link, ctx.cache); diff --git a/lib/routes/wechat-open/pay/announce.js b/lib/routes/wechat-open/pay/announce.js index 162bf59bf3..0d32296524 100644 --- a/lib/routes/wechat-open/pay/announce.js +++ b/lib/routes/wechat-open/pay/announce.js @@ -1,17 +1,21 @@ const got = require('@/utils/got'); module.exports = async (ctx) => { - const data = (await got({ - method: 'get', - url: - 'https://pay.weixin.qq.com/index.php/public/cms/get_contents?id=6200&cmstype=1&url=https%253A%252F%252Fpay.weixin.qq.com%252Fpublic%252Fcms%252Fcontent_list%253Flang%253Dzh%2526id%253D6200&states=2&publishtimeend=1565537507&expiretimebeg=1565537507&propertyinclude=1&ordertype=4&field=contentId%2CcontentTitle%2CcontentPublishTime&g_ty=ajax', - })).data.data.contentlist; + const data = ( + await got({ + method: 'get', + url: + 'https://pay.weixin.qq.com/index.php/public/cms/get_contents?id=6200&cmstype=1&url=https%253A%252F%252Fpay.weixin.qq.com%252Fpublic%252Fcms%252Fcontent_list%253Flang%253Dzh%2526id%253D6200&states=2&publishtimeend=1565537507&expiretimebeg=1565537507&propertyinclude=1&ordertype=4&field=contentId%2CcontentTitle%2CcontentPublishTime&g_ty=ajax', + }) + ).data.data.contentlist; - const data2 = (await got({ - method: 'get', - url: - 'https://pay.weixin.qq.com/index.php/public/cms/get_contents?pagenum=1&id=6200&cmstype=1&url=https%253A%252F%252Fpay.weixin.qq.com%252Fpublic%252Fcms%252Fcontent_list%253Flang%253Dzh%2526id%253D6200&states=2&publishtimeend=1565537507&expiretimebeg=1565537507&propertyexclude=1&ordertype=4&field=contentId%2CcontentTitle%2CcontentPublishTime&g_ty=ajax', - })).data.data.contentlist; + const data2 = ( + await got({ + method: 'get', + url: + 'https://pay.weixin.qq.com/index.php/public/cms/get_contents?pagenum=1&id=6200&cmstype=1&url=https%253A%252F%252Fpay.weixin.qq.com%252Fpublic%252Fcms%252Fcontent_list%253Flang%253Dzh%2526id%253D6200&states=2&publishtimeend=1565537507&expiretimebeg=1565537507&propertyexclude=1&ordertype=4&field=contentId%2CcontentTitle%2CcontentPublishTime&g_ty=ajax', + }) + ).data.data.contentlist; data.push(...data2);