feat: remove notOperational routes - new media

This commit is contained in:
DIYgod
2023-12-19 00:49:24 +08:00
parent 37b20f8bd7
commit 442d68e189
235 changed files with 30 additions and 7951 deletions
-20
View File
@@ -346,27 +346,7 @@
},
],
},
'buaq.net': { _name: '不安全资讯', '.': [{ title: '不安全资讯', docs: 'http://docs.rsshub.app/routes/new-media#bu-an-quan', source: '/', target: '/buaq' }] },
'jian-ning.com': { _name: '建宁闲谈', '.': [{ title: '文章', docs: 'https://docs.rsshub.app/routes/blog#jian-ning-xian-tan', source: '/*', target: '/blogs/jianning' }] },
'matataki.io': {
_name: 'matataki',
www: [
{ title: '最热作品', docs: 'https://docs.rsshub.app/routes/new-media#matataki', source: '/article/', target: '/matataki/posts/hot' },
{ title: '最新作品', docs: 'https://docs.rsshub.app/routes/new-media#matataki', source: '/article/latest', target: '/matataki/posts/latest' },
{ title: '作者创作', docs: 'https://docs.rsshub.app/routes/new-media#matataki', source: '/user/:uid', target: (params) => `/matataki/users/${params.uid}/posts` },
{ title: 'Fan票关联作品', docs: 'https://docs.rsshub.app/routes/new-media#matataki', source: ['/token/:tokenId', '/token/:tokenId/circle'], target: (params) => `/matataki/tokens/${params.tokenId}/posts` },
{
title: '标签关联作品',
docs: 'https://docs.rsshub.app/routes/new-media#matataki',
source: ['/tag/:tagId'],
target: (params, url) => {
const tagName = new URL(url).searchParams.get('name');
return `/matataki/tags/${params.tagId}/${tagName}/posts`;
},
},
{ title: '收藏夹', docs: 'https://docs.rsshub.app/routes/new-media#matataki', source: '/user/:uid/favlist/:fid', target: (params) => `/matataki/users/${params.uid}/favorites/${params.fid}/posts` },
],
},
'eventernote.com': { _name: 'Eventernote', www: [{ title: '声优活动及演唱会', docs: 'https://docs.rsshub.app/routes/anime#eventernote', source: '/actors/:name/:id/events', target: '/eventernote/actors/:name/:id' }] },
'huya.com': { _name: '虎牙直播', '.': [{ title: '直播间开播', docs: 'https://docs.rsshub.app/routes/live#hu-ya-zhi-bo-zhi-bo-jian-kai-bo', source: '/:id', target: '/huya/live/:id' }] },
'craigslist.org': { _name: 'Craigslist', '.': [{ title: '商品搜索列表', docs: 'https://docs.rsshub.app/routes/shopping#craigslist' }] },
-55
View File
@@ -925,17 +925,6 @@ module.exports = {
},
],
},
'buaq.net': {
_name: '不安全资讯',
'.': [
{
title: '不安全资讯',
docs: 'http://docs.rsshub.app/routes/new-media#bu-an-quan',
source: '/',
target: '/buaq',
},
],
},
'jian-ning.com': {
_name: '建宁闲谈',
'.': [
@@ -947,50 +936,6 @@ module.exports = {
},
],
},
'matataki.io': {
_name: 'matataki',
www: [
{
title: '最热作品',
docs: 'https://docs.rsshub.app/routes/new-media#matataki',
source: '/article/',
target: '/matataki/posts/hot',
},
{
title: '最新作品',
docs: 'https://docs.rsshub.app/routes/new-media#matataki',
source: '/article/latest',
target: '/matataki/posts/latest',
},
{
title: '作者创作',
docs: 'https://docs.rsshub.app/routes/new-media#matataki',
source: '/user/:uid',
target: (params) => `/matataki/users/${params.uid}/posts`,
},
{
title: 'Fan票关联作品',
docs: 'https://docs.rsshub.app/routes/new-media#matataki',
source: ['/token/:tokenId', '/token/:tokenId/circle'],
target: (params) => `/matataki/tokens/${params.tokenId}/posts`,
},
{
title: '标签关联作品',
docs: 'https://docs.rsshub.app/routes/new-media#matataki',
source: ['/tag/:tagId'],
target: (params, url) => {
const tagName = new URL(url).searchParams.get('name');
return `/matataki/tags/${params.tagId}/${tagName}/posts`;
},
},
{
title: '收藏夹',
docs: 'https://docs.rsshub.app/routes/new-media#matataki',
source: '/user/:uid/favlist/:fid',
target: (params) => `/matataki/users/${params.uid}/favorites/${params.fid}/posts`,
},
],
},
'huya.com': {
_name: '虎牙直播',
'.': [
+1 -204
View File
@@ -40,9 +40,6 @@ router.get('/mzitu/tag/:tag', lazyloadRouteHandler('./routes/mzitu/tag'));
// pixiv-fanbox
router.get('/fanbox/:user?', lazyloadRouteHandler('./routes/fanbox/main'));
// 法律白話文運動
router.get('/plainlaw/archives', lazyloadRouteHandler('./routes/plainlaw/archives.js'));
// Dockone
router.get('/dockone/weekly', lazyloadRouteHandler('./routes/dockone/weekly'));
@@ -51,9 +48,6 @@ router.get('/zcfy', lazyloadRouteHandler('./routes/zcfy/index'));
router.get('/zcfy/index', lazyloadRouteHandler('./routes/zcfy/index')); // 废弃
router.get('/zcfy/hot', lazyloadRouteHandler('./routes/zcfy/hot'));
// 今日头条
router.get('/jinritoutiao/keyword/:keyword', lazyloadRouteHandler('./routes/jinritoutiao/keyword'));
// Disqus
router.get('/disqus/posts/:forum', lazyloadRouteHandler('./routes/disqus/posts'));
@@ -131,9 +125,6 @@ router.get('/one', lazyloadRouteHandler('./routes/one/index'));
// Thunderbird
router.get('/thunderbird/release', lazyloadRouteHandler('./routes/thunderbird/release'));
// tuicool
router.get('/tuicool/mags/:type', lazyloadRouteHandler('./routes/tuicool/mags'));
// Hexo
router.get('/hexo/next/:url', lazyloadRouteHandler('./routes/hexo/next'));
router.get('/hexo/yilia/:url', lazyloadRouteHandler('./routes/hexo/yilia'));
@@ -169,9 +160,6 @@ router.get('/wikipedia/mainland', lazyloadRouteHandler('./routes/wikipedia/mainl
// 联合国 United Nations
router.get('/un/scveto', lazyloadRouteHandler('./routes/un/scveto'));
// e 公司
// router.get('/egsea/flash', lazyloadRouteHandler('./routes/egsea/flash'));
// 选股宝
router.get('/xuangubao/subject/:subject_id', lazyloadRouteHandler('./routes/xuangubao/subject'));
@@ -493,7 +481,6 @@ router.get('/geekpark/breakingnews', lazyloadRouteHandler('./routes/geekpark/bre
// 百度
router.get('/baidu/doodles', lazyloadRouteHandler('./routes/baidu/doodles'));
// router.get('/baidu/topwords/:boardId?', lazyloadRouteHandler('./routes/baidu/topwords'));
router.get('/baidu/daily', lazyloadRouteHandler('./routes/baidu/daily'));
// 搜狗
router.get('/sogou/doodles', lazyloadRouteHandler('./routes/sogou/doodles'));
@@ -513,13 +500,6 @@ router.get('/gnn/gnn', lazyloadRouteHandler('./routes/gnn/gnn'));
// a9vg游戏新闻
router.get('/a9vg/a9vg', lazyloadRouteHandler('./routes/a9vg/a9vg'));
// IT桔子
router.get('/itjuzi/invest', lazyloadRouteHandler('./routes/itjuzi/invest'));
router.get('/itjuzi/merge', lazyloadRouteHandler('./routes/itjuzi/merge'));
// 探物
router.get('/tanwu/products', lazyloadRouteHandler('./routes/tanwu/products'));
// GitChat
router.get('/gitchat/newest/:category?/:selected?', lazyloadRouteHandler('./routes/gitchat/newest'));
@@ -607,7 +587,6 @@ router.get('/tingdiantz/95598/:province/:city/:district?', lazyloadRouteHandler(
// PMCAFF
router.get('/pmcaff/list/:typeid', lazyloadRouteHandler('./routes/pmcaff/list'));
router.get('/pmcaff/feed/:typeid', lazyloadRouteHandler('./routes/pmcaff/feed'));
router.get('/pmcaff/user/:userid', lazyloadRouteHandler('./routes/pmcaff/user'));
// icourse163
router.get('/icourse163/newest', lazyloadRouteHandler('./routes/icourse163/newest'));
@@ -706,10 +685,6 @@ router.get('/duozhi', lazyloadRouteHandler('./routes/duozhi'));
// 高清电台
router.get('/gaoqing/latest', lazyloadRouteHandler('./routes/gaoqing/latest'));
// 鲸跃汽车
router.get('/whalegogo/home', lazyloadRouteHandler('./routes/whalegogo/home'));
router.get('/whalegogo/portal/:type_id/:tagid?', lazyloadRouteHandler('./routes/whalegogo/portal'));
// LeetCode
// router.get('/leetcode/articles', lazyloadRouteHandler('./routes/leetcode/articles'));
router.get('/leetcode/submission/us/:user', lazyloadRouteHandler('./routes/leetcode/check-us'));
@@ -725,9 +700,6 @@ router.get('/sketch/updates', lazyloadRouteHandler('./routes/sketch/updates'));
// 每日安全
router.get('/security/pulses', lazyloadRouteHandler('./routes/security/pulses'));
// DoNews
router.get('/donews/:column?', lazyloadRouteHandler('./routes/donews/index'));
// WeGene
router.get('/wegene/column/:type/:category', lazyloadRouteHandler('./routes/wegene/column'));
router.get('/wegene/newest', lazyloadRouteHandler('./routes/wegene/newest'));
@@ -739,9 +711,6 @@ router.get('/instapaper/person/:name', lazyloadRouteHandler('./routes/instapaper
router.get('/ui-cn/article', lazyloadRouteHandler('./routes/ui-cn/article'));
router.get('/ui-cn/user/:id', lazyloadRouteHandler('./routes/ui-cn/user'));
// 决胜网
router.get('/juesheng', lazyloadRouteHandler('./routes/juesheng'));
// 一些博客
// 敬维-以认真的态度做完美的事情: https://jingwei.link/
router.get('/blogs/jingwei.link', lazyloadRouteHandler('./routes/blogs/jingwei_link'));
@@ -755,9 +724,6 @@ router.get('/blogs/wang54/:id?', lazyloadRouteHandler('./routes/blogs/wang54'));
// WordPress
router.get('/blogs/wordpress/:domain/:https?', lazyloadRouteHandler('./routes/blogs/wordpress'));
// 西祠胡同
router.get('/xici/:id?', lazyloadRouteHandler('./routes/xici'));
// 今日热榜 migrated to v2
// router.get('/tophub/:id', lazyloadRouteHandler('./routes/tophub'));
@@ -819,15 +785,9 @@ router.get('/matters/author/:uid', lazyloadRouteHandler('./routes/matters/author
// MobData
router.get('/mobdata/report', lazyloadRouteHandler('./routes/mobdata/report'));
// 谷雨
router.get('/tencent/guyu/channel/:name', lazyloadRouteHandler('./routes/tencent/guyu/channel'));
// 古诗文网
router.get('/gushiwen/recommend/:annotation?', lazyloadRouteHandler('./routes/gushiwen/recommend'));
// 电商在线
router.get('/imaijia/category/:category', lazyloadRouteHandler('./routes/imaijia/category'));
// 21财经
router.get('/21caijing/channel/:name', lazyloadRouteHandler('./routes/21caijing/channel'));
@@ -898,10 +858,6 @@ router.get('/paidai/news', lazyloadRouteHandler('./routes/paidai/news'));
// 漫画db
router.get('/manhuadb/comics/:id', lazyloadRouteHandler('./routes/manhuadb/comics'));
// 装备前线
router.get('/zfrontier/postlist/:type', lazyloadRouteHandler('./routes/zfrontier/postlist'));
router.get('/zfrontier/board/:boardId', lazyloadRouteHandler('./routes/zfrontier/board_postlist'));
// Hpoi 手办维基
router.get('/hpoi/info/:type?', lazyloadRouteHandler('./routes/hpoi/info'));
router.get('/hpoi/:category/:words', lazyloadRouteHandler('./routes/hpoi'));
@@ -925,7 +881,7 @@ router.get('/enclavebooks/collection/:uid', lazyloadRouteHandler('./routes/encla
router.get('/digitaling/index', lazyloadRouteHandler('./routes/digitaling/index'));
// 数英网文章专题
router.get('/digitaling/articles/:category/:subcate', lazyloadRouteHandler('./routes/digitaling/article'));
router.get('/digitaling/articles/:category/:subcate?', lazyloadRouteHandler('./routes/digitaling/article'));
// 数英网项目专题
router.get('/digitaling/projects/:category', lazyloadRouteHandler('./routes/digitaling/project'));
@@ -939,9 +895,6 @@ router.get('/maxnews/dota2', lazyloadRouteHandler('./routes/maxnews/dota2'));
// 柠檬 - 私房歌
router.get('/ningmeng/song', lazyloadRouteHandler('./routes/ningmeng/song'));
// 紫竹张先生
router.get('/zzz/:category?/:language?', lazyloadRouteHandler('./routes/zzz'));
// AlgoCasts
router.get('/algocasts', lazyloadRouteHandler('./routes/algocasts/all'));
@@ -982,19 +935,12 @@ router.get('/dekudeals/:type', lazyloadRouteHandler('./routes/dekudeals'));
// 快科技(原驱动之家)
// router.get('/kkj/news', lazyloadRouteHandler('./routes/kkj/news'));
// sixthtone
router.get('/sixthtone/news', lazyloadRouteHandler('./routes/sixthtone/news'));
// AI研习社
router.get('/aiyanxishe/:id/:sort?', lazyloadRouteHandler('./routes/aiyanxishe/home'));
// 活动行
router.get('/huodongxing/explore', lazyloadRouteHandler('./routes/hdx/explore'));
// 巴比特作者专栏
router.get('/8btc/:authorid', lazyloadRouteHandler('./routes/8btc/author'));
router.get('/8btc/news/flash', lazyloadRouteHandler('./routes/8btc/news/flash'));
// LWN.net Alerts
router.get('/lwn/alerts/:distributor', lazyloadRouteHandler('./routes/lwn/alerts'));
@@ -1008,9 +954,6 @@ router.get('/lolapp/article/:uuid', lazyloadRouteHandler('./routes/lolapp/articl
// 左岸读书
router.get('/zreading', lazyloadRouteHandler('./routes/zreading/home'));
// NBA
router.get('/nba/app_news', lazyloadRouteHandler('./routes/nba/app_news'));
// 天津产权交易中心
router.get('/tprtc/cqzr', lazyloadRouteHandler('./routes/tprtc/cqzr'));
router.get('/tprtc/qyzc', lazyloadRouteHandler('./routes/tprtc/qyzc'));
@@ -1049,9 +992,6 @@ router.get('/meituan/tech/home', lazyloadRouteHandler('./routes//meituan/tech/ho
router.get('/codeceo/home', lazyloadRouteHandler('./routes/codeceo/home'));
router.get('/codeceo/:type/:category?', lazyloadRouteHandler('./routes/codeceo/category'));
// BOF
router.get('/bof/home', lazyloadRouteHandler('./routes/bof/home'));
// 爱发电
router.get('/afdian/explore/:type?/:category?', lazyloadRouteHandler('./routes/afdian/explore'));
router.get('/afdian/dynamic/:uid', lazyloadRouteHandler('./routes/afdian/dynamic'));
@@ -1079,7 +1019,6 @@ router.get('/wikihow/category/:category/:type', lazyloadRouteHandler('./routes/w
router.get('/10000link/news/:category?', lazyloadRouteHandler('./routes/10000link/news'));
// 一兜糖
router.get('/yidoutang/index', lazyloadRouteHandler('./routes/yidoutang/index.js'));
router.get('/yidoutang/guide', lazyloadRouteHandler('./routes/yidoutang/guide.js'));
router.get('/yidoutang/mtest', lazyloadRouteHandler('./routes/yidoutang/mtest.js'));
router.get('/yidoutang/case/:type', lazyloadRouteHandler('./routes/yidoutang/case.js'));
@@ -1158,9 +1097,6 @@ router.get('/weidian/goods/:id', lazyloadRouteHandler('./routes/weidian/goods'))
// 有赞
router.get('/youzan/goods/:id', lazyloadRouteHandler('./routes/youzan/goods'));
// 币世界快讯
router.get('/bishijie/kuaixun', lazyloadRouteHandler('./routes/bishijie/kuaixun'));
// 顺丰丰桥
router.get('/sf/sffq-announce', lazyloadRouteHandler('./routes/sf/sffq-announce'));
@@ -1205,12 +1141,6 @@ router.get('/nfmovies/:id?', lazyloadRouteHandler('./routes/nfmovies/index'));
// 书友社区
router.get('/andyt/:view?', lazyloadRouteHandler('./routes/andyt/index'));
// 品途商业评论
router.get('/pintu360/:type?', lazyloadRouteHandler('./routes/pintu360/index'));
// engadget中国版
router.get('/engadget-cn', lazyloadRouteHandler('./routes/engadget/home'));
// engadget
router.get('/engadget/:lang?', lazyloadRouteHandler('./routes/engadget/home'));
@@ -1247,9 +1177,6 @@ router.get('/zhanqi/room/:id', lazyloadRouteHandler('./routes/zhanqi/room'));
// 酒云网
router.get('/wineyun/:category', lazyloadRouteHandler('./routes/wineyun'));
// 快知
router.get('/kzfeed/topic/:id', lazyloadRouteHandler('./routes/kzfeed/topic'));
// X-MOL化学资讯平台
// router.get('/x-mol/news/:tag?', lazyloadRouteHandler('./routes/x-mol/news.js'));
// router.get('/x-mol/paper/:type/:magazine', lazyloadRouteHandler('./routes/x-mol/paper'));
@@ -1535,9 +1462,6 @@ router.get('/lagou/jobs/:position/:city', lazyloadRouteHandler('./routes/lagou/j
router.get('/yzu/home/:type', lazyloadRouteHandler('./routes/universities/yzu/home'));
router.get('/yzu/yjszs/:type', lazyloadRouteHandler('./routes/universities/yzu/yjszs'));
// 德国新闻社卫健新闻
router.get('/krankenkassen', lazyloadRouteHandler('./routes/krankenkassen'));
// 桂林航天工业学院
router.get('/guat/news/:type?', lazyloadRouteHandler('./routes/guat/news'));
@@ -1821,9 +1745,6 @@ router.get('/missevan/drama/:id', lazyloadRouteHandler('./routes/missevan/drama'
// AMD
router.get('/amd/graphicsdrivers/:id/:rid?', lazyloadRouteHandler('./routes/amd/graphicsdrivers'));
// 电商报
router.get('/dsb/area/:area', lazyloadRouteHandler('./routes/dsb/area'));
// 靠谱新闻
router.get('/kaopunews/:language?', lazyloadRouteHandler('./routes/kaopunews'));
@@ -1857,7 +1778,6 @@ router.get('/kuaibao', lazyloadRouteHandler('./routes/kuaibao/index'));
// SocialBeta
router.get('/socialbeta/home', lazyloadRouteHandler('./routes/socialbeta/home'));
router.get('/socialbeta/hunt', lazyloadRouteHandler('./routes/socialbeta/hunt'));
// 东方我乐多丛志
router.get('/touhougarakuta/:language/:type', lazyloadRouteHandler('./routes/touhougarakuta'));
@@ -1896,12 +1816,6 @@ router.get('/tencent/bigdata', lazyloadRouteHandler('./routes/tencent/bigdata/in
// 搜韵网
router.get('/souyun/today', lazyloadRouteHandler('./routes/souyun/today'));
// 生物谷
router.get('/bioon/latest', lazyloadRouteHandler('./routes/bioon/latest'));
// soomal
router.get('/soomal/topics/:category/:language?', lazyloadRouteHandler('./routes/soomal/topics'));
// JustRun
router.get('/justrun', lazyloadRouteHandler('./routes/justrun/index'));
@@ -1943,9 +1857,6 @@ router.get('/wenxuecity/bbs/:cat/:elite?', lazyloadRouteHandler('./routes/wenxue
router.get('/wenxuecity/hot/:cid', lazyloadRouteHandler('./routes/wenxuecity/hot'));
router.get('/wenxuecity/news', lazyloadRouteHandler('./routes/wenxuecity/news'));
// 不安全
router.get('/buaq', lazyloadRouteHandler('./routes/buaq/index'));
// 快出海
router.get('/kchuhai', lazyloadRouteHandler('./routes/kchuhai/index'));
@@ -1970,9 +1881,6 @@ router.get('/blogs/jianning', lazyloadRouteHandler('./routes/blogs/jianning'));
// 互动吧
router.get('/hudongba/:city/:id', lazyloadRouteHandler('./routes/hudongba/index'));
// 飞雪娱乐网
router.get('/feixuew/:id?', lazyloadRouteHandler('./routes/feixuew/index'));
// 1X
router.get('/1x/:category?', lazyloadRouteHandler('./routes/1x/index'));
@@ -1982,15 +1890,8 @@ router.get('/jx3/:caty?', lazyloadRouteHandler('./routes/jx3/news'));
// 泉州市跨境电子商务协会
router.get('/qzcea/:caty?', lazyloadRouteHandler('./routes/qzcea/index'));
// 福利年
router.get('/fulinian/:caty?', lazyloadRouteHandler('./routes/fulinian/index'));
// CGTN
router.get('/cgtn/top', lazyloadRouteHandler('./routes/cgtn/top'));
router.get('/cgtn/most/:type?/:time?', lazyloadRouteHandler('./routes/cgtn/most'));
router.get('/cgtn/pick', lazyloadRouteHandler('./routes/cgtn/pick'));
router.get('/cgtn/opinions', lazyloadRouteHandler('./routes/cgtn/opinions'));
// AppSales
@@ -2042,9 +1943,6 @@ router.get('/gov/taiwan/mnd', lazyloadRouteHandler('./routes/gov/taiwan/mnd'));
// 高科技行业门户
router.get('/ofweek/news', lazyloadRouteHandler('./routes/ofweek/news'));
// 八阕
router.get('/popyard/:caty?', lazyloadRouteHandler('./routes/popyard/index'));
// World Trade Organization
router.get('/wto/dispute-settlement/:year?', lazyloadRouteHandler('./routes/wto/dispute-settlement'));
@@ -2054,12 +1952,6 @@ router.get('/forum4399/:mtag', lazyloadRouteHandler('./routes/game4399/forum'));
// 国防科技大学
router.get('/nudt/yjszs/:id?', lazyloadRouteHandler('./routes/universities/nudt/yjszs'));
// 全现在
router.get('/allnow/column/:id', lazyloadRouteHandler('./routes/allnow/column'));
router.get('/allnow/tag/:id', lazyloadRouteHandler('./routes/allnow/tag'));
router.get('/allnow/user/:id', lazyloadRouteHandler('./routes/allnow/user'));
router.get('/allnow', lazyloadRouteHandler('./routes/allnow/index'));
// dev.to
router.get('/dev.to/top/:period', lazyloadRouteHandler('./routes/dev.to/top'));
@@ -2110,12 +2002,6 @@ router.get('/nwpu/:column', lazyloadRouteHandler('./routes/nwpu/index'));
// 美国联邦最高法院
router.get('/us/supremecourt/argument_audio/:year?', lazyloadRouteHandler('./routes/us/supremecourt/argument_audio'));
// 未名新闻
router.get('/mitbbs/:caty?', lazyloadRouteHandler('./routes/mitbbs/index'));
// 贾真的电商108将
router.get('/jiazhen108', lazyloadRouteHandler('./routes/jiazhen108/index'));
// 优设网
router.get('/uisdc/talk/:sort?', lazyloadRouteHandler('./routes/uisdc/talk'));
router.get('/uisdc/hangye/:caty?', lazyloadRouteHandler('./routes/uisdc/hangye'));
@@ -2123,9 +2009,6 @@ router.get('/uisdc/news', lazyloadRouteHandler('./routes/uisdc/news'));
router.get('/uisdc/zt/:title?', lazyloadRouteHandler('./routes/uisdc/zt'));
router.get('/uisdc/topic/:title?/:sort?', lazyloadRouteHandler('./routes/uisdc/topic'));
// 中国劳工观察
router.get('/chinalaborwatch/reports/:lang?/:industry?', lazyloadRouteHandler('./routes/chinalaborwatch/reports'));
// 美国中央情报局
router.get('/cia/foia-annual-report', lazyloadRouteHandler('./routes/us/cia/foia-annual-report'));
@@ -2135,15 +2018,9 @@ router.get('/everything/changes', lazyloadRouteHandler('./routes/everything/chan
// 中国劳工通讯
router.get('/clb/commentary/:lang?', lazyloadRouteHandler('./routes/clb/commentary'));
// 国际教育研究所
router.get('/iie/blog', lazyloadRouteHandler('./routes/iie/blog'));
// 超理论坛
router.get('/chaoli/:channel?', lazyloadRouteHandler('./routes/chaoli/index'));
// Polar
router.get('/polar/blog', lazyloadRouteHandler('./routes/polar/blog'));
// XYplorer
router.get('/xyplorer/whatsnew', lazyloadRouteHandler('./routes/xyplorer/whatsnew'));
@@ -2166,23 +2043,6 @@ router.get('/qstheory/:category?', lazyloadRouteHandler('./routes/qstheory/index
// 生命时报
router.get('/lifetimes/:category?', lazyloadRouteHandler('./routes/lifetimes/index'));
// MakeUseOf
router.get('/makeuseof/:category?', lazyloadRouteHandler('./routes/makeuseof/index'));
// 瞬Matataki
// 热门作品
router.get('/matataki/posts/hot/:ipfsFlag?', lazyloadRouteHandler('./routes/matataki/site/posts/scoreranking'));
// 最新作品
router.get('/matataki/posts/latest/:ipfsFlag?', lazyloadRouteHandler('./routes/matataki/site/posts/timeranking'));
// 作者创作
router.get('/matataki/users/:authorId/posts/:ipfsFlag?', lazyloadRouteHandler('./routes/matataki/site/posts/author'));
// Fan票关联作品
router.get('/matataki/tokens/:id/posts/:filterCode/:ipfsFlag?', lazyloadRouteHandler('./routes/matataki/site/posts/token'));
// 标签关联作品
router.get('/matataki/tags/:tagId/:tagName/posts/:ipfsFlag?', lazyloadRouteHandler('./routes/matataki/site/posts/tag'));
// 收藏夹
router.get('/matataki/users/:userId/favorites/:favoriteListId/posts/:ipfsFlag?', lazyloadRouteHandler('./routes/matataki/site/posts/favorite'));
// Zhimap 知识导图社区
router.get('/zhimap/:categoryUuid?/:recommend?', lazyloadRouteHandler('./routes/zhimap/index'));
@@ -2203,9 +2063,6 @@ router.get('/mind42/:caty?', lazyloadRouteHandler('./routes/mind42/index'));
// 幕布网
router.get('/mubu/explore/:category?/:title?', lazyloadRouteHandler('./routes/mubu/explore'));
// Esquirehk
router.get('/esquirehk/tag/:id', lazyloadRouteHandler('./routes/esquirehk/tag'));
// 国家普通话测试 杭州市
router.get('/putonghua', lazyloadRouteHandler('./routes/putonghua/hangzhou'));
@@ -2220,9 +2077,6 @@ router.get('/yinxiang/card/:id', lazyloadRouteHandler('./routes/yinxiang/card'))
router.get('/yinxiang/personal/:id', lazyloadRouteHandler('./routes/yinxiang/personal'));
router.get('/yinxiang/category/:id', lazyloadRouteHandler('./routes/yinxiang/category'));
// 遠見 gvm.com.tw
router.get('/gvm/index/:category?', lazyloadRouteHandler('./routes/gvm/index'));
// 触乐
router.get('/chuapp/index/:category?', lazyloadRouteHandler('./routes/chuapp/index'));
@@ -2247,9 +2101,6 @@ router.get('/ustr/press-releases/:year?/:month?', lazyloadRouteHandler('./routes
// 游戏动力
router.get('/vgn/:platform?', lazyloadRouteHandler('./routes/vgn/index'));
// 国际能源署
router.get('/iea/:category?', lazyloadRouteHandler('./routes/iea/index'));
// The Brain
router.get('/thebrain/:category?', lazyloadRouteHandler('./routes/thebrain/blog'));
@@ -2265,9 +2116,6 @@ router.get('/marginnote/tag/:id?', lazyloadRouteHandler('./routes/marginnote/tag
// ASML
router.get('/asml/press-releases', lazyloadRouteHandler('./routes/asml/press-releases'));
// 中国机械工程学会
router.get('/cmes/news/:category?', lazyloadRouteHandler('./routes/cmes/news'));
// Craigslist
router.get('/craigslist/:location/:type', lazyloadRouteHandler('./routes/craigslist/search'));
@@ -2282,12 +2130,6 @@ router.get('/mathunion/fields-medal', lazyloadRouteHandler('./routes/mathunion/f
// ACM
router.get('/acm/amturingaward', lazyloadRouteHandler('./routes/acm/amturingaward'));
// 網路天文館
router.get('/tam/forecast', lazyloadRouteHandler('./routes/tam/forecast'));
// Day One
router.get('/dayone/blog', lazyloadRouteHandler('./routes/dayone/blog'));
// 滴答清单
router.get('/dida365/habit/checkins', lazyloadRouteHandler('./routes/dida365/habit-checkins'));
@@ -2297,24 +2139,12 @@ router.get('/ditto/changes/:type?', lazyloadRouteHandler('./routes/ditto/changes
// iDaily 每日环球视野
router.get('/idaily/today', lazyloadRouteHandler('./routes/idaily/index'));
// 北屋
router.get('/northhouse/:category?', lazyloadRouteHandler('./routes/northhouse/index'));
// Oak Ridge National Laboratory
router.get('/ornl/news', lazyloadRouteHandler('./routes/ornl/news'));
// 信阳师范学院 自考办
router.get('/xynu/zkb/:category', lazyloadRouteHandler('./routes/universities/xynu/zkb'));
// Bell Labs
router.get('/bell-labs/events-news/:category?', lazyloadRouteHandler('./routes/bell-labs/events-news.js'));
// 中国科学院青年创新促进会
router.get('/yicas/blog', lazyloadRouteHandler('./routes/yicas/blog'));
// 九三学社
router.get('/93/:category?', lazyloadRouteHandler('./routes/93/index'));
// DailyArt
router.get('/dailyart/:language?', lazyloadRouteHandler('./routes/dailyart/index'));
@@ -2333,21 +2163,12 @@ router.get('/nace/blog/:sort?', lazyloadRouteHandler('./routes/nace/blog'));
// Semiconductor Industry Association
router.get('/semiconductors/latest-news', lazyloadRouteHandler('./routes/semiconductors/latest-news'));
// VOA News
router.get('/voa/day-photos', lazyloadRouteHandler('./routes/voa/day-photos'));
// Voice of America
router.get('/voa/:language/:channel?', lazyloadRouteHandler('./routes/voa/index'));
// 游戏葡萄
router.get('/gamegrape/:id?', lazyloadRouteHandler('./routes/gamegrape/index'));
// 阳光高考
router.get('/chsi/zszcgd/:category?', lazyloadRouteHandler('./routes/chsi/zszcgd'));
// 眾新聞
router.get('/hkcnews/news/:category?', lazyloadRouteHandler('./routes/hkcnews/news'));
// AnyTXT
router.get('/anytxt/release-notes', lazyloadRouteHandler('./routes/anytxt/release-notes'));
@@ -2390,12 +2211,6 @@ router.get('/cqut/libnews', lazyloadRouteHandler('./routes/universities/cqut/cqu
// 城农 Growin' City
router.get('/growincity/news/:id?', lazyloadRouteHandler('./routes/growincity/news'));
// Thrillist
router.get('/thrillist/:tag?', lazyloadRouteHandler('./routes/thrillist/index'));
// 丁香园
router.get('/dxy/vaccine/:province?/:city?/:location?', lazyloadRouteHandler('./routes/dxy/vaccine'));
// 中国庭审公开网
router.get('/tingshen', lazyloadRouteHandler('./routes/tingshen/tingshen'));
@@ -2463,9 +2278,6 @@ router.get('/furaffinity/favorites/:username/:nsfw?', lazyloadRouteHandler('./ro
router.get('/furaffinity/submission_comments/:id', lazyloadRouteHandler('./routes/furaffinity/submission_comments'));
router.get('/furaffinity/journal_comments/:id', lazyloadRouteHandler('./routes/furaffinity/journal_comments'));
// 亿欧网
router.get('/iyiou', lazyloadRouteHandler('./routes/iyiou'));
// 香港商报
router.get('/hkcd/pdf', lazyloadRouteHandler('./routes/hkcd/pdf'));
@@ -2483,9 +2295,6 @@ router.get('/trakt/collection/:username/:type?', lazyloadRouteHandler('./routes/
// 全球化智库
router.get('/ccg/:category?', lazyloadRouteHandler('./routes/ccg/index'));
// 中国橡胶网
router.get('/cria/news/:id?', lazyloadRouteHandler('./routes/cria/news'));
// 灵异网
router.get('/lingyi/:category', lazyloadRouteHandler('./routes/lingyi/index'));
@@ -2526,9 +2335,6 @@ router.get('/hugo/releases', lazyloadRouteHandler('./routes/hugo/releases'));
// 东立出版
router.get('/tongli/news/:type', lazyloadRouteHandler('./routes/tongli/news'));
// OR
router.get('/or/:id?', lazyloadRouteHandler('./routes/or'));
// 字型故事
router.get('/fontstory', lazyloadRouteHandler('./routes/fontstory/tw'));
@@ -2571,12 +2377,6 @@ router.get('/tanchinese/:category?', lazyloadRouteHandler('./routes/tanchinese')
// yuzu emulator
router.get('/yuzu-emu/entry', lazyloadRouteHandler('./routes/yuzu-emu/entry'));
// Resources - The Partnership on AI
router.get('/partnershiponai/resources', lazyloadRouteHandler('./routes/partnershiponai/resources'));
// Common App
router.get('/commonapp/blog', lazyloadRouteHandler('./routes/commonapp/blog'));
// Europa Press
router.get('/europapress/:category?', lazyloadRouteHandler('./routes/europapress'));
@@ -2609,9 +2409,6 @@ router.get('/x410/news', lazyloadRouteHandler('./routes/x410/news'));
router.get('/micmicidol', lazyloadRouteHandler('./routes/micmicidol/latest'));
router.get('/micmicidol/search/:label', lazyloadRouteHandler('./routes/micmicidol/search'));
// 香港高登
router.get('/hkgolden/:id?/:limit?/:sort?', lazyloadRouteHandler('./routes/hkgolden'));
// 香港討論區
router.get('/discuss/:fid', lazyloadRouteHandler('./routes/discuss'));
+1 -1
View File
@@ -1,6 +1,6 @@
const utils = require('./utils');
const rootUrl = 'http://www.199it.com/archives/category/';
const rootUrl = 'https://www.199it.com/archives/category';
module.exports = async (ctx) => {
const keyword = ctx.params.caty.split('|').join('/');
+1 -1
View File
@@ -1,6 +1,6 @@
const utils = require('./utils');
const rootUrl = 'http://www.199it.com/archives/tag/';
const rootUrl = 'https://www.199it.com/archives/tag';
module.exports = async (ctx) => {
const keyword = ctx.params.tag.split('|').join('/');
+1 -1
View File
@@ -25,7 +25,7 @@ module.exports = async (ctx, keyword, currentUrl) => {
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
url: `https:${item.link}`,
});
const content = cheerio.load(detailResponse.data);
-49
View File
@@ -1,49 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const authorid = ctx.params.authorid;
const response = await got.get(`https://webapi.8btc.com/bbt_api/comments/list?author_id=${authorid}&fetch_num=20`);
const ProcessFeed = (data) => {
const $ = cheerio.load(data);
// 提取内容
return $('.bbt-html').html();
};
const items = await Promise.all(
response.data.data.list.map(async (item) => {
const link = `https://www.8btc.com/article/${item.post_id}`;
const cache = await ctx.cache.get(link);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got({
method: 'get',
url: link,
});
const description = ProcessFeed(response.data);
const single = {
title: item.post.title,
description,
pubDate: item.date_gmt,
link,
author: item.reviewer.name,
};
ctx.cache.set(link, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: '巴比特作者专栏',
link: `https://www.8btc.com/author/${authorid}`,
description: '巴比特作者专栏',
item: items,
};
};
-41
View File
@@ -1,41 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: `https://app.blockmeta.com/w1/news/list?num=30&cat_id=4481&page=1`,
headers: {
from: 'web',
Referer: `https://www.8btc.com/flash`,
},
});
const newsflashes = response.data.list;
let newsflashesList = [];
for (let i = 0; i < newsflashes.length; i++) {
newsflashesList = newsflashesList.concat(newsflashes[i]);
}
const out = newsflashesList.map((item) => {
const pubDate = item.post_date_format;
const link = item.source.link;
const title = item.title;
const description = item.content;
const single = {
title,
link,
pubDate,
description,
};
return single;
});
ctx.state.data = {
title: `快讯 - 巴比特`,
link: `https://www.8btc.com/flash`,
item: out,
};
};
-50
View File
@@ -1,50 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const category = ctx.params.category || 'lxzn-yzjy';
const rootUrl = 'http://www.93.gov.cn';
const currentUrl = `${rootUrl}/${category}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('li.clearfix a')
.slice(0, 15)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
pubDate: new Date(item.next().text()).toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.pageContent').html();
item.author = content('.pageTitle ul li').eq(1).text().replace('来源:', '');
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-7
View File
@@ -1,7 +0,0 @@
const utils = require('./utils');
module.exports = async (ctx) => {
const id = ctx.params.id;
ctx.state.data = await utils.processItems(ctx, `${utils.rootUrl}/column/${id}`);
};
-5
View File
@@ -1,5 +0,0 @@
const utils = require('./utils');
module.exports = async (ctx) => {
ctx.state.data = await utils.processItems(ctx, utils.rootUrl);
};
-7
View File
@@ -1,7 +0,0 @@
const utils = require('./utils');
module.exports = async (ctx) => {
const id = ctx.params.id;
ctx.state.data = await utils.processItems(ctx, `${utils.rootUrl}/tag/${id}`);
};
-7
View File
@@ -1,7 +0,0 @@
const utils = require('./utils');
module.exports = async (ctx) => {
const id = ctx.params.id;
ctx.state.data = await utils.processItems(ctx, `${utils.rootUrl}/user/${id}`);
};
-67
View File
@@ -1,67 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
const rootUrl = 'https://www.allnow.com';
module.exports = {
rootUrl,
processItems: async (ctx, currentUrl) => {
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.post-list .post')
.slice(0, ctx.params.limit ? parseInt(ctx.params.limit) : 15)
.map((_, item) => {
item = $(item);
return {
link: `${rootUrl}${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.author = detailResponse.data.match(/authorName:"(.*?)",avatar/)[1];
item.title = content('title')
.text()
.replace(/-全现在官方网站/, '');
item.pubDate = timezone(parseDate(detailResponse.data.match(/time:"(.*)",type/)[1]), +8);
item.category = detailResponse.data
.match(/tags:\[(.*)\],columns/)[1]
.split('},')
.map((category) => category.match(/title:"(.*)"/)[1]);
item.description = content('#article-content').html() ?? content('.summary').html() ?? '';
content('video').each(function () {
item.description += `<video src="https:${content(this).attr('src')}" controls></video>`;
});
return item;
})
)
);
return {
title: $('title').text(),
link: currentUrl,
item: items,
description: $('.desc').eq(0).text(),
};
},
};
-55
View File
@@ -1,55 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const iconv = require('iconv-lite');
module.exports = async (ctx) => {
const host = `https://zhidao.baidu.com/daily?fr=daohang`;
const response = await got.get(host, {
responseType: 'buffer',
});
response.data = iconv.decode(response.data, 'gbk');
const $ = cheerio.load(response.data);
const list = $("li[class=' clearfix']").get();
const items = list.map((item) => {
item = $(item);
return {
title: item.find('div.daily-cont-top > h2 > a').text(),
description: item.find('div.daily-cont-top > div > a').text(),
link: `https://zhidao.baidu.com/${item.find('div.daily-cont-top > h2 > a').attr('href')}`,
};
});
const result = await Promise.all(
items.map(async (item) => {
const link = item.link;
const cache = await ctx.cache.get(link);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const itemReponse = await got.get(link, {
responseType: 'buffer',
});
const data = iconv.decode(itemReponse.data, 'gbk');
const itemElement = cheerio.load(data);
item.description = itemElement('.detail-wp').html();
ctx.cache.set(link, JSON.stringify(item));
return item;
})
);
ctx.state.data = {
title: `知道日报`,
link: host,
description: `每天都知道一点`,
item: result,
};
};
-70
View File
@@ -1,70 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const config = {
events: '.tout-text a',
'industry-recognition': '.n-block-section .n-block .rich-text p b',
'press-releases': 'h5 a',
};
module.exports = async (ctx) => {
const category = ctx.params.category || 'press-releases';
const rootUrl = 'http://www.bell-labs.com';
const currentUrl = `${rootUrl}/events-news/${category}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
let items = (category === 'industry-recognition' ? $(config[category]).closest('.rich-text') : $(config[category]))
.slice(0, 15)
.map((_, i) => {
let item = $(i);
if (category === 'industry-recognition') {
item = item.children('.n-link-list').length > 0 ? item.children('.n-link-list') : item.children('p').eq(1);
}
if (item.children('a').attr('href')) {
item = item.children('a');
}
return {
title: item.text(),
link: item.attr('href') || currentUrl,
pubDate: new Date(category === 'events' ? item.text().split(':')[0].split(' - ')[0] : category === 'industry-recognition' ? $(i).children('p').eq(0).text() : '').toUTCString(),
description: category === 'events' ? item.closest('.n-block').next().find('.rich-text').html() : category === 'industry-recognition' ? `<p>${$(i).find('p').last().text()}</p>` : '',
};
})
.get();
if (category === 'press-releases') {
items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('.social-media-sharing').remove();
item.description = content('.layout-content').html();
item.pubDate = new Date(content('meta[name="search-updated"]').attr('content')).toUTCString();
return item;
})
)
);
}
ctx.state.data = {
title: $('title').eq(0).text(),
link: currentUrl,
item: items,
};
};
-51
View File
@@ -1,51 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const currentUrl = 'http://www.bioon.com';
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('#cms_list li[data-i]')
.slice(0, 10)
.map((_, item) => {
item = $(item);
const a = item.find('a');
return {
title: a.text(),
link: a.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
const subtitle = content('div.title5 p').text().split(' ');
const pubDate = `${subtitle.slice(-2)[0]} ${subtitle.slice(-1)}`;
item.pubDate = new Date(pubDate + ' GMT+8').toUTCString();
item.description = content('div.text3').html();
return item;
})
)
);
ctx.state.data = {
title: '生物谷 - 最新资讯',
link: currentUrl,
item: items,
};
};
-21
View File
@@ -1,21 +0,0 @@
const buildData = require('@/utils/common-config');
module.exports = async (ctx) => {
const link = `https://www.bishijie.com/kuaixun/`;
const host = `https://www.bishijie.com`;
ctx.state.data = await buildData({
link,
url: link,
title: `%title%`,
params: {
title: '币世界快讯列表',
host,
},
item: {
item: 'ul.newscontainer > li',
title: `$('div.content a h3').text()`,
link: `$('div.content a').attr('href')`,
description: `$('div.content div.news-content div').html()`,
},
});
};
-42
View File
@@ -1,42 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'POST',
url: 'https://www.businessoffashion.com/graphql/v1',
headers: {
'Content-Type': 'application/json',
},
data: JSON.stringify({
operationName: 'GetArticlesGQL',
variables: {
first: 5,
lastCursor: null,
height: 440,
width: 670,
},
query: 'query GetArticlesGQL($articleSlug: String, $category: String, $authorSlug: String, $height: Int, $lastCursor: ID, $width: Int!, $first: Int) {\n articles(first: $first, after: $lastCursor, filter: {language__eq: chinese, articleSlug__eq: $articleSlug, categorySlug__eq: $category, authorSlug__eq: $authorSlug}) {\n edges {\n cursor\n node {\n __typename\n ... on ArticleInterface {\n title\n summary\n content\n url\n featuredAsset {\n ... on AssetInterface {\n caption\n __typename\n }\n ... on ManagedImage {\n transform(transform: {width: $width, height: $height, crop: FOCALPOINT, fit: CROP})\n __typename\n }\n ... on ManagedVideo {\n url\n __typename\n }\n __typename\n }\n isExclusive\n isSponsored\n published {\n value\n __typename\n }\n __typename\n }\n ... on InternalArticleInterface {\n authors {\n displayName\n slug\n __typename\n }\n __typename\n }\n ... on ExternalArticleInterface {\n source\n __typename\n }\n ... on CuratedArticleLink {\n _id\n title\n published {\n value\n __typename\n }\n url\n __typename\n }\n ... on SyndicatedArticle {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n __typename\n }\n __typename\n }\n ... on OriginalArticle {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n slug\n __typename\n }\n __typename\n }\n ... on FashionWeekReview {\n _id\n topics {\n _id\n label\n __typename\n }\n categories {\n _id\n label\n __typename\n }\n __typename\n }\n }\n __typename\n }\n __typename\n }\n}\n',
}),
});
const items = response.data.data.articles.edges.map((item) => {
const url = new URL(item.node.url);
url.host = 'cn.businessoffashion.com';
const single = {
title: item.node.title,
description: `${item.node.summary}<br>${item.node.content}`,
pubDate: new Date(item.node.published.value).toUTCString(),
link: url.href,
author: item.node.authors[0].displayName,
};
return single;
});
ctx.state.data = {
title: `BoF时装商业评论 | 时刻为全球时尚产业提供最新的新闻、分析与情报 | BoF`,
link: `https://cn.businessoffashion.com/`,
description: 'BoF时装商业评论 | 时刻为全球时尚产业提供最新的新闻、分析与情报 | BoF',
item: items,
};
};
-31
View File
@@ -1,31 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const baseUrl = 'https://buaq.net';
const response = await got({
method: 'get',
url: baseUrl,
});
const $ = cheerio.load(response.data); // 使用 cheerio 加载返回的 HTML
const list = $('tr[class]');
ctx.state.data = {
title: `不安全文章 ~ 资讯`,
link: `https://buaq.net/`,
description: '不安全文章 ~ 资讯',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: $('font[size="4"]', item).children('a').text(),
pubDate: new Date($('font[size="1"]', item).children().first().text()).toUTCString(),
link: baseUrl + $('font[size="4"]', item).children('a').attr('href'),
};
})
.get(),
};
};
-45
View File
@@ -1,45 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'https://www.cgtn.com/';
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const list = $('.titleArea')
.map((_, item) => {
item = $(item);
const a = item.find('a');
return {
title: a.text(),
link: a.attr('href'),
pubDate: new Date(parseInt(a.attr('data-time'))).toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('#cmsMainContent').html();
return item;
})
)
);
ctx.state.data = {
title: "CGTN - Editors' Pick",
link: rootUrl,
item: items,
};
};
-45
View File
@@ -1,45 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'https://www.cgtn.com/';
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const list = $('div.topNews-item')
.map((_, item) => {
item = $(item);
const a = item.find('div.topNews-item-content-title a');
return {
title: a.text(),
link: a.attr('href'),
pubDate: new Date(parseInt(a.attr('data-time'))).toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('#cmsMainContent').html();
return item;
})
)
);
ctx.state.data = {
title: 'CGTN - Top News',
link: rootUrl,
item: items,
};
};
-53
View File
@@ -1,53 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const lang = ctx.params.lang || '';
const industry = ctx.params.industry || '';
const rootUrl = 'http://www.chinalaborwatch.org';
const currentUrl = `${rootUrl}/${lang === '' ? '' : 'cn/'}reports${industry === '' ? '' : `/industry/${industry}`}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.Alt1 a, .Alt2 a')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.pubDate = new Date(content('#ContentPlaceHolder1_LabelDate').text().replace(/年|月/g, '-').replace('日', '')).toUTCString();
content('h1, #ContentPlaceHolder1_LabelDate').remove();
item.description = content('.mainContent').html();
return item;
})
)
);
ctx.state.data = {
title: `${$('title').text()} - ${lang === '' ? 'China Labour Watch' : '中国劳工观察'}`,
link: currentUrl,
item: items,
};
};
-64
View File
@@ -1,64 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const category = ctx.params.category || 'Information';
const rootUrl = 'https://www.cmes.org';
const currentUrl = `${rootUrl}/News/${category}/index.html`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.r_ct')
.find('a')
.slice(0, 10)
.map((_, item) => {
item = $(item);
const link = item.attr('href');
let date = '00000000';
if (link.split('/')[2] !== 'mkc.ckcest.cn') {
date = link.split('/')[5];
}
return {
link,
title: item.text(),
pubDate: new Date(`${date.substr(0, 4)}-${date.substr(5, 2)}-${date.substr(7, 2)}`).toDateString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('h3, script, .bshare-custom').remove();
item.description = content('.xhjj').html() || content('.detail-page').html();
if (content('#articleTime').html()) {
item.pubDate = new Date(content('#articleTime').text()).toUTCString();
}
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-42
View File
@@ -1,42 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const rootUrl = 'https://www.commonapp.org';
const jsonUrl = `${rootUrl}/page-data/sq/d/4283793559.json`;
const response = await got({
method: 'get',
url: jsonUrl,
});
const list = response.data.data.allNodeBlogPost.edges.map((item) => ({
title: item.node.title,
author: item.node.field_blog_author,
pubDate: parseDate(item.node.created),
link: `${rootUrl}${item.node.path.alias}`,
}));
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.inner-page').html();
return item;
})
)
);
ctx.state.data = {
title: 'Blog - Common App',
link: `${rootUrl}/blog`,
item: items,
};
};
-57
View File
@@ -1,57 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const id = ctx.params.id || '';
const rootUrl = 'http://www.cria.org.cn';
const currentUrl = `${rootUrl}/${id ? `newslist/${id}.html` : 'news'}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.ch_news,.enterprise_news_c')
.find('ul li')
.map((_, item) => {
item = $(item);
const a = item.find('a');
return {
link: `${rootUrl}${a.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
try {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.title = content('title').text();
item.description = content('.news_details_c').html();
item.pubDate = new Date(detailResponse.data.match(/<span>发布时间:(.*)<\/span><span>来源:/)[1]).toUTCString();
return item;
} catch (e) {
return Promise.resolve('');
}
})
)
);
const title = id ? response.data.match(/<h3><span style="margin: 10px; font-size:15px;">当前位置:中国橡胶网 > (.*)<\/span><\/h3>/)[1] : '新闻资讯';
ctx.state.data = {
title: `${title} - 中国橡胶网`,
link: currentUrl,
item: items,
};
};
-56
View File
@@ -1,56 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'https://dayoneapp.com';
const currentUrl = `${rootUrl}/blog`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('h3 a')
.slice(0, 20)
.map((_, item) => {
item = $(item);
const info = item.parent().next().text().split(' by ');
return {
author: info[1],
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
pubDate: new Date(info[0]).toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
const description = content('.blog-layout');
description.children().last().remove();
content('h1').next().remove();
content('h1').remove();
item.description = description.html();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-59
View File
@@ -1,59 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const util = require('./utils');
module.exports = async (ctx) => {
const { column = '' } = ctx.params;
let host = `http://www.donews.com/${column}`;
if (column !== '' && column !== 'idonews') {
host += '/index';
}
const response = await got.get(host);
const $ = cheerio.load(response.data);
let list,
title = 'DoNews - ';
if (column === '') {
title += '首页';
} else {
title += $('.breadCrumb > a:nth-child(2)').text();
}
switch (column) {
case '':
// 首页轮播
list = $('a.news-item').get();
break;
case 'ent':
case 'idonews':
// 首页轮播
list = $('ul.zl-top > li > a').get();
list = list.concat($('.fl.w840 > .block > dl > dd > h3 > a').slice(0, 5).get());
break;
default:
list = $('.fl.w840 > .block > dl > dd > h3 > a').slice(0, 10).get();
break;
}
const items = await Promise.all(
list.map((e) => {
const link = $(e).attr('href');
return ctx.cache.tryGet(link, () => util.ProcessFeed(link));
})
);
ctx.state.data = {
title,
link: host,
description: '中国最早的web2.0网站,专业科技媒体、互联网行业门户网站。提供互联网新闻IT资讯,关注科技创新,覆盖移动互联网创业、游戏、风险投资等热点,是中国互联网行业的风向标。',
item: items,
};
};
-19
View File
@@ -1,19 +0,0 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
const ProcessFeed = async (link) => {
const response = await got.get(link);
const $ = cheerio.load(response.data);
return {
title: $('.detail-con h1').text() || $('.detail-con h2').text().replace('{{news.title}}', ''),
author: $('.tag > .fl > span:nth-child(2)').text().replace('{{news.author}}', ''),
description: $('.article-con').html(),
pubDate: new Date($('.tag > .fl > span:nth-child(1)').text().replace('{{news.timeFormat}}', '')),
link,
};
};
module.exports = {
ProcessFeed,
};
-33
View File
@@ -1,33 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const area = ctx.params.area;
const host = 'www.dsb.cn';
const areaUrl = `http://${host}/${area}`;
const areaResp = await got(areaUrl);
const $ = cheerio.load(areaResp.data);
const areaName = $('.new-list-title').text();
const newsUrls = $('ul.new-list-cons > li > a')
.map((i, e) => $(e).attr('href'))
.get();
ctx.state.data = {
title: `电商报 - ${areaName}`,
link: areaUrl,
item: await Promise.all(
newsUrls.map((url) =>
ctx.cache.tryGet(url, async () => {
const newsResp = await got(url);
const $ = cheerio.load(newsResp.data);
return {
title: $('.new-content > h2').text(),
link: url,
pubDate: $('.new-content-info > span:nth-child(3)').text(),
description: $('div.new-content-con').html(),
};
})
)
),
};
};
-109
View File
@@ -1,109 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const province = ctx.params.province || '';
const city = ctx.params.city || '';
const location = ctx.params.location || '';
let fullLocation = '';
if (province) {
fullLocation += `/${province}`;
if (city) {
fullLocation += `/${city}`;
if (location) {
fullLocation += `/${location}`;
}
}
}
const rootUrl = 'https://mama.dxy.com';
const currentUrl = `${rootUrl}/client/vaccine/new-crown-vaccine`;
const apiUrl = `${rootUrl}/api/vaccine/client/vaccination-point/all`;
const apiResponse = await got({
method: 'get',
url: apiUrl,
});
const response = await got({
method: 'get',
url: apiResponse.data.results.fileUrl,
});
const allPoints = [],
allLocations = {},
allLocationIds = {},
pointDataArray = response.data.results.pointData;
for (const data of pointDataArray) {
allLocations[data.locationName] = data.locationId;
allLocationIds[data.locationId] = data.locationName;
if (data.points) {
allPoints.push(...data.points);
} else {
pointDataArray.push(...data.pointData);
}
}
const list = allPoints.map((item) => {
const locationId = item.locationId;
const province = locationId - (locationId % 10000);
const city = locationId - (locationId % 100);
return {
title: `${allLocationIds[province]}/${allLocationIds.hasOwnProperty(city) ? `${allLocationIds[city]}/` : `${allLocationIds[province]}/`}${allLocationIds[locationId]}`,
link: item.contentUrl,
pubDate: new Date(item.modifyDate).toUTCString(),
};
});
const items = await Promise.all(
list
.filter((item) => {
if (fullLocation !== '') {
const locationSplit = item.title.split('/');
const fullLocationSplit = fullLocation.split('/');
for (let index = 0; index < fullLocationSplit.length; index++) {
if (locationSplit[index] !== fullLocationSplit[index]) {
return false;
}
}
}
return true;
})
.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const result = detailResponse.data.results;
const description =
`<h1> ${result.point.pointName}</h1>` +
'<ul>' +
`<li>户籍限制:${result.point.registerLimit}</li>` +
`<li>服务限制:${result.point.serviceTag}</li>` +
`<li>服务时间:${result.detail.serviceTime}</li>` +
`<li>地址:${result.point.address}</li>` +
`<li>电话:${result.point.phoneNo}</li>` +
`<li>接种人群:${result.detail.targetPeople}</li>` +
`<li>接种所需材料:${result.detail.materials}</li>` +
`<li>预约步骤:${result.detail.reserveSteps}</li>` +
'</ul>';
item.description = description;
item.title = `${result.point.pointName}(${item.title})`;
item.link = `${rootUrl}/client/vaccine/vaccination-point?pointId=${result.point.id}`;
return item;
})
)
);
ctx.state.data = {
title: `新冠疫苗接种点查询${fullLocation ? `(${fullLocation})` : ''} - 丁香园`,
link: currentUrl,
item: items,
};
};
-71
View File
@@ -1,71 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
let id = ctx.params.id || 'Fashion';
id = id.toLowerCase();
const rootUrl = 'https://www.esquirehk.com';
const topics = ['style', 'watch', 'money-investment', 'lifestyle', 'culture', 'mens-talk', 'gear', 'people'];
let currentUrl = `${rootUrl}/tag/${id}`;
if (topics.indexOf(id) > -1) {
currentUrl = `${rootUrl}/${id}`;
}
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.FeedStory')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
author: item.find('.author').text(),
link: `${rootUrl}${item.find('a.Anchor').eq(0).attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('.RelatedBlock').remove();
content('.TagContainer').remove();
content('.YouMayLikeContainer').remove();
content('.SubscriptionContainer').remove();
content('img').each(function () {
const srcset = content(this).attr('srcset');
if (srcset) {
content(this).removeAttr('srcset');
content(this).removeAttr('data-src');
content(this).attr('src', `${rootUrl}${srcset.split(',')[1].replace('1032w', '')}`);
}
});
item.title = content('.CommonTitle').text();
item.description = content('.ArticlePage').html();
item.pubDate = new Date(content('.ArticleFeeds-info time').eq(0).attr('data-timestamp') * 1000).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: `${$('title').text()} - Esquirehk`,
link: currentUrl,
item: items,
};
};
-63
View File
@@ -1,63 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
let currentUrl;
let query;
const rootUrl = 'https://www.feixuew.com';
ctx.params.id = ctx.params.id || 'latest';
if (ctx.params.id === 'latest') {
currentUrl = rootUrl;
} else {
currentUrl = `${rootUrl}/sort/${ctx.params.id}`;
}
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
if (ctx.params.id === 'latest') {
query = $('ul.ul-new li a').slice(4, 10);
} else {
query = $('a.sjwu').slice(0, 10);
}
const list = query
.map((_, item) => {
item = $(item);
return {
title: item.attr('title'),
link: item.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('div.info-con').html();
item.pubDate = new Date(content('p.f-sgray span').eq(1).text().replace('发布时间:', '') + ' GMT+8').toUTCString();
return item;
})
)
);
ctx.state.data = {
title: `飞雪娱乐网 - ${$('title').text().split('-')[0]}`,
link: currentUrl,
item: items,
};
};
-50
View File
@@ -1,50 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'https://www.fulinian.com/';
module.exports = async (ctx) => {
ctx.params.caty = ctx.params.caty || '';
const currentUrl = `${rootUrl}/${ctx.params.caty}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('article.excerpt')
.slice(0, 10)
.map((_, item) => {
item = $(item);
const a = item.find('header h2 a');
return {
title: a.text(),
link: a.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('article.article-content').html();
item.pubDate = new Date(content('div.article-meta span.item').eq(0).text() + ' GMT+8').toUTCString();
return item;
})
)
);
ctx.state.data = {
title: `福利年 - ${$('h1').text()}`,
link: currentUrl,
item: items,
};
};
-73
View File
@@ -1,73 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
function getNum(str) {
const result = str.match(/(\d{1,2}).*/);
if (result) {
return parseInt(result[1]);
}
}
function resolveRelativeTime(relativeTime) {
const result = /\S* · (\d{1,2}天)?(\d{1,2}小时)?(\d{1,2}分钟)?/.exec(relativeTime);
let day, hour, min;
if (result[1]) {
day = getNum(result[1]);
}
if (result[2]) {
hour = getNum(result[2]);
}
if (result[3]) {
min = getNum(result[3]);
}
return (((day || 0) * 24 + (hour || 0)) * 60 + (min || 0)) * 60 * 1000;
}
module.exports = async (ctx) => {
const id = ctx.params.id || '';
const rootUrl = 'http://youxiputao.com';
const currentUrl = `${rootUrl}/article${id ? `/index/id/${id}` : ''}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.news-info-box')
.slice(0, 15)
.map((_, item) => {
item = $(item);
const a = item.find('a[title]');
return {
title: a.text(),
link: `${rootUrl}${a.attr('href')}`,
pubDate: Date.now() - resolveRelativeTime(item.find('.pull-right').text()),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.info').html();
item.author = content('.users-info h4').text();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-94
View File
@@ -1,94 +0,0 @@
const got = require('got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const category = ctx.params.category || 'newest';
let suffix = '/newest';
const options = {
newest: '最新文章',
recommend: '你可能會喜歡',
opinion: '名家專欄',
topic: '專題',
news: '時事熱點',
politics: '政治',
society: '社會',
figure: '人物報導',
world: '國際',
world_focus: '全球焦點',
cross_strait_politics: '兩岸',
money: '金融理財',
investment: '投資理財',
insurance: '保險規劃',
retire: '退休理財',
fintech: '金融Fintech',
real_estate: '房地產',
economy: '總體經濟',
tech: '科技',
tech_trend: '科技趨勢',
energy: '能源',
business: '產經',
industry: '傳產',
service: '消費服務',
medical: '生技醫藥',
family_business_succession: '傳承轉型',
startup: '創業新創',
management: '管理',
agriculture: '農業',
education: '教育',
higher_education: '高教',
technological: '技職',
parent: '親子教育',
world_education: '國際文教',
sports: '體育',
life: '好享生活',
art: '時尚設計',
self_growth: '心靈成長',
film: '藝文影視',
travel: '旅遊',
environment: '環境生態',
health: '健康',
food: '美食',
career: '職場生涯',
survey: '調查',
county: '縣市',
csr: 'CSR',
};
if (category !== 'newest' && category !== 'recommend') {
suffix = `/category/${category}`;
}
const response = await got({
method: 'get',
url: 'https://www.gvm.com.tw' + suffix,
});
const $ = cheerio.load(response.body);
const articles = $('#article_list .article-list-item .article-list-item__intro')
.map((index, ele) => ({
title: $('a', ele).text(),
link: $('a', ele).attr('href'),
pubDate: new Date($('.time', ele).text()),
author: $('.author', ele).text(),
}))
.get();
const item = await Promise.all(
articles.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const res = await got.get(item.link);
const content = cheerio.load(res.body);
item.description = content('.article-content').html();
return item;
})
)
);
ctx.state.data = {
title: `遠見 - ${options[category]}`,
link: 'https://www.gvm.com.tw' + suffix,
item,
};
};
-63
View File
@@ -1,63 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const titles = {
'': '眾聞',
13: '經濟',
15: '社會',
14: '生活',
12: '政治',
16: '國際',
20: '台灣',
21: '人物',
19: '中國',
};
module.exports = async (ctx) => {
const category = ctx.params.category || '';
const rootUrl = 'https://www.hkcnews.com';
const apiUrl = `${rootUrl}/data/newsposts${category === '' ? '' : `/${category}`}?page=1`;
const response = await got({
method: 'get',
url: apiUrl,
});
const list = response.data.items.map((item) => {
const $ = cheerio.load(item);
const news = $('.article-block-body a');
const date = $('.line').eq(1).text().split('.').reverse().join('-');
return {
title: news.text(),
link: `${rootUrl}${news.attr('href')}`,
pubDate: new Date(date.length === 8 ? `${new Date().getFullYear().toString().slice(0, 2)}${date}` : date).toUTCString(),
};
});
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.article-content').html();
// substring 2 times
// from https://hkcnews.com/article/47878/loreal歐萊雅-薇婭-李佳琦-47884/薇婭、李佳琦幫loreal帶貨引價格爭議-loreal道歉
// to https://hkcnews.com/article/47878
item.guid = item.link.substring(0, item.link.lastIndexOf('/')).substring(0, item.link.substring(0, item.link.lastIndexOf('/')).lastIndexOf('/'));
return item;
})
)
);
ctx.state.data = {
title: `眾新聞 - ${titles[category]}`,
link: `${rootUrl}/news${category === '' ? '' : `/${category}/${titles[category]}`}`,
item: items,
};
};
-110
View File
@@ -1,110 +0,0 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
const dayjs = require('dayjs');
const channels = {
BW: '吹水台',
HT: '高登熱',
NW: '最 新',
CA: '時事台',
ET: '娛樂台',
SP: '體育台',
FN: '財經台',
ST: '學術台',
SY: '講故台',
EP: '創意台',
HW: '硬件台',
IN: '電訊台',
SW: '軟件台',
MP: '手機台',
AP: 'Apps台',
GM: '遊戲台',
ED: '飲食台',
TR: '旅遊台',
CO: '潮流台',
AN: '動漫台',
TO: '玩具台',
MU: '音樂台',
VI: '影視台',
DC: '攝影台',
TS: '汽車台',
WK: '上班台',
LV: '感情台',
SC: '校園台',
BB: '親子台',
PT: '寵物台',
MB: '站務台',
RA: '電 台',
AC: '活動台',
BS: '買賣台',
JT: '直播台',
AU: '成人台',
OP: '考古台',
};
const limits = {
'-1': '全部',
1: '正式',
0: '公海',
};
const sorts = {
0: '最後回應時間',
1: '發表時間',
2: '熱門',
};
module.exports = async (ctx) => {
const id = ctx.params.id || 'BW';
const sort = ctx.params.sort || '0';
const limit = ctx.params.limit || '-1';
const rootUrl = 'https://forum.hkgolden.com';
const apiRootUrl = 'https://api.hkgolden.com';
const apiUrl = `${apiRootUrl}/v1/topics/HT/1?sort=${sort}&limit=${limit}`;
const response = await got({
method: 'get',
url: apiUrl,
});
const list = response.data.data.list.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 30).map((item) => ({
link: item.id,
title: item.title,
author: item.authorName,
pubDate: parseDate(item.orderDate),
}));
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: `${apiRootUrl}/v1/view/${item.link}`,
});
const data = detailResponse.data.data;
item.link = `${rootUrl}/thread/${item.id}`;
item.description =
`<table border="1" cellspacing="0"><tr><td>${data.authorName}&nbsp(${dayjs(data.messageDate).format('YYYY-MM-DD hh:mm:ss')})</td></tr>` +
`<tr><td>${data.content.replace(/src="\/faces/g, 'src="https://assets.hkgolden.com/faces')}</td></tr>`;
for (const reply of data.replies) {
item.description +=
`<tr><td>${reply.authorName}&nbsp(${dayjs(reply.replyDate).format('YYYY-MM-DD hh:mm:ss')})</td></tr>` + `<tr><td>${reply.content.replace(/src="\/faces/g, 'src="https://assets.hkgolden.com/faces')}</td></tr>`;
}
item.description += '</table>';
return item;
})
)
);
ctx.state.data = {
title: `${channels[id]} (${sorts[sort]}|${limits[limit]}) - 香港高登`,
link: `${rootUrl}/channel/${id}`,
item: items,
};
};
-53
View File
@@ -1,53 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const category = ctx.params.category || 'news-and-events';
const rootUrl = 'https://www.iea.org';
const currentUrl = `${rootUrl}/${category}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.m-news-listing__hover')
.slice(0, 15)
.map((_, item) => {
item = $(item);
const title = $(item).text();
item = item.parent().get(0).tagName === 'a' ? $(item).parent() : $(item).parent().parent();
return {
title,
link: `${rootUrl}${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.m-block__content').html();
item.pubDate = new Date(content('.o-hero-freepage__meta').text()).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: $('title').eq(0).text(),
link: currentUrl,
item: items,
};
};
-47
View File
@@ -1,47 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'https://www.iie.org';
const currentUrl = `${rootUrl}/Learn/Blog`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.events__title a')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
pubDate: new Date(item.parent().parent().find('time').attr('datetime')).toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.wysiwyg').html();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-63
View File
@@ -1,63 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const category = ctx.params.category;
const api_url = `http://www.imaijia.com/xstb/front/authorArticleController.do?indexArticles&pageSize=20`;
const url = `http://www.imaijia.com/#/information.htm?catid=${category}`;
const response = await got({
method: 'post',
headers: {
Referer: url,
},
url: api_url,
form: {
pageNo: 1,
catid: category,
},
});
const data = response.data;
const description = data.description;
const name = data.catName;
const list = data.resList;
const out = await Promise.all(
list.map(async (info) => {
const title = info.title;
const cat_path = info.catPath;
const id = info.id;
const itemUrl = `http://www.imaijia.com/#/atricleDetails.htm?atricleId=${id}&catPath=${cat_path}`;
const api_url = `http://www.imaijia.com/data/details/${cat_path}${id}.json`;
const pubDate = info.created;
const author = info.author;
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(api_url);
const description = response.data.resList.articleDataF.content.replace(/src="/g, 'src="http://www.imaijia.com');
const single = {
title,
link: itemUrl,
author,
description,
pubDate: new Date(pubDate).toUTCString(),
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: `电商在线-${name}`,
description,
link: url,
item: out,
};
};
-32
View File
@@ -1,32 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://www.itjuzi.com/api/index/invse',
});
const data = response.data;
ctx.state.data = {
title: 'IT桔子-投融资事件',
link: 'https://www.itjuzi.com/',
item: data.map((item) => {
const invest = item.invst.map((item) => item.name).join('、');
return {
title: `${item.name} / ${item.round} / ${item.money}`,
link: `https://www.itjuzi.com/company/${item.invse_com_id}`,
description: `
<img src="${item.logo}"><br><br>
<strong>${item.name}</strong><br>
${item.slogan}<br>
${item.round} / ${item.money} / ${item.time}<br>
投资方: ${invest}
`,
pubDate: new Date(item.time).toUTCString(),
guid: item.id,
};
}),
};
};
-32
View File
@@ -1,32 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://www.itjuzi.com/api/index/merge',
});
const data = response.data.data;
ctx.state.data = {
title: 'IT桔子-并购事件',
link: 'https://www.itjuzi.com/',
item: data.map((item) => {
const party = item.party.map((item) => item.name || item.invst_name).join('、');
return {
title: `${item.name}-${item.slogan}`,
link: `https://www.itjuzi.com/merger/${item.id}`,
description: `
<img src="${item.logo}"><br><br>
<strong>${item.name}</strong><br>
${item.slogan}<br>
股权占比: ${item.ratio} / 金额: ${item.money} / ${item.time}<br>
并购方: ${party}
`,
pubDate: new Date(item.time).toUTCString(),
guid: item.id,
};
}),
};
};
-41
View File
@@ -1,41 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const formatPubDate = require('@/utils/date.js');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: `https://www.iyiou.com/news`,
});
const $ = cheerio.load(response.data);
const postList = $('.list-container').find('.eo-article-column').get();
const result = await Promise.all(
postList.map(async (item) => {
const title = $(item).find('.eo-hover-child').find('.content').find('a').find('.title').text();
const link = 'https://www.iyiou.com' + $(item).find('.eo-hover-child').find('a').attr('href');
const guid = link;
const pubDate = formatPubDate($(item).find('.eo-hover-child').find('.content').find('.eo-post-date').text().replace(' ', ''));
const single = {
title,
link,
guid,
pubDate,
description: '',
};
const description_key = 'iyiou' + guid;
const description_value = await ctx.cache.get(description_key);
if (description_value) {
single.description = description_value;
} else {
const temp = await got(link);
single.description = $(temp.data).find('.post-body').html();
ctx.cache.set(description_key, single.description);
}
return Promise.resolve(single);
})
);
ctx.state.data = { title: '亿欧网', link: 'https://www.iyiou.com/', item: result };
};
-47
View File
@@ -1,47 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'http://www.jiazhen108.com/news/';
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const list = $('div.met-news-list ul li')
.slice(0, 10)
.map((_, item) => {
item = $(item);
const a = item.find('a');
return {
title: a.text(),
link: a.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('section.met-editor').html();
item.pubDate = new Date(content('div.info span').eq(0).text() + ' GMT+8').toUTCString();
return item;
})
)
);
ctx.state.data = {
title: `「108将」实战分享`,
link: rootUrl,
item: items,
};
};
-27
View File
@@ -1,27 +0,0 @@
const got = require('../../utils/got');
module.exports = async (ctx) => {
const keyword = ctx.params.keyword;
const response = await got({
method: 'get',
url: `https://www.toutiao.com/api/search/content/?offset=0&format=json&keyword=${encodeURIComponent(keyword)}&autoload=true&count=20&cur_tab=1&from=search_tab`,
headers: {
Referer: `https://www.toutiao.com/search/?keyword=${encodeURIComponent(keyword)}`,
},
});
let data = response.data.data;
data = data.filter((item) => !item.cell_type);
ctx.state.data = {
title: `今日头条: ${keyword}`,
link: `https://www.toutiao.com/search/?keyword=${keyword}`,
description: keyword,
item: data.map((item) => ({
title: `${item.media_name}: ${item.title}`,
description: item.abstract,
pubDate: new Date(parseInt(item.create_time) * 1000),
link: item.article_url,
})),
};
};
-49
View File
@@ -1,49 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got('http://www.juesheng.com/');
const $ = cheerio.load(response.data);
const postList = $('.sec-box #informationBox li').get();
const result = await Promise.all(
postList.map(async (item) => {
const title = $(item).find('.news-item-title').find('a').text();
const link = $(item).find('.news-item-title').find('a').attr('href');
const guid = link;
const single = {
title,
link,
guid,
pubDate: '',
description: '',
};
const description_key = 'juesheng_description_' + guid;
const description_value = await ctx.cache.get(description_key);
const pubDate_key = 'juesheng_pubDate_' + guid;
const pubDate_value = await ctx.cache.get(pubDate_key);
if (description_value && pubDate_value) {
single.description = description_value;
single.pubDate = pubDate_value;
} else {
const temp = await got(link);
single.description = $(temp.data).find('.content-box').html();
single.pubDate = new Date($(temp.data).find('.part-time').text()).toUTCString();
ctx.cache.set(description_key, single.description);
ctx.cache.set(pubDate_key, single.pubDate);
}
return Promise.resolve(single);
})
);
ctx.state.data = {
title: '决胜网',
link: 'http://www.juesheng.com/',
description: '决胜网是教育产业门户网站提供:教育门户新闻资讯、互联网+教育、在线教育、兴趣教育、在线职业教育、教育创业、教育信息化、教育创业报道等,找教育就上决胜网教育门户网站。',
item: result,
};
};
-54
View File
@@ -1,54 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://www.krankenkassen.de/dpa/',
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('.news td a');
const getContent = async (subLink) => {
const cacheKey = `krankenkassen_${subLink}`;
const cache = await ctx.cache.get(cacheKey);
if (cache) {
return JSON.parse(cache);
}
const articlePageRes = await got(subLink);
const articleHtml = articlePageRes.data;
const $ = cheerio.load(articleHtml);
const pubDate = $('.untertitel').text();
const description = $('#content p').text();
const result = {
pubDate,
description,
title: $('.titel').text(),
link: subLink,
};
ctx.cache.set(cacheKey, JSON.stringify(result));
return result;
};
const item = await Promise.all(
list
.slice(0, 30)
.map((index, dom) => {
dom = $(dom);
const link = `https://www.krankenkassen.de/dpa/${dom.attr('href')}`;
return getContent(link);
})
.get()
);
ctx.state.data = {
title: $('title').text(),
link: 'https://www.krankenkassen.de/dpa/',
description: '德国新闻社卫健新闻',
item,
};
};
-122
View File
@@ -1,122 +0,0 @@
/**
* 这里列出部分已知用途且在 Feed 中有用的属性
*
* @typedef {Object} Card
* @property {String} id 卡片 id
* @property {String} title 卡片标题
* @property {String} text 正文内容,会有换行符,里面的链接会是 <a-link href="..."></a-link> 的形式
* @property {String} video 可能是内嵌视频地址
* @property {String} video_thumb_img 可能是内嵌视频预览图片
* @property {Number} bilibili_video_id 可能是关联的 Bilibili av 号
* @property {String[]} images 内嵌图片地址
* @property {Card~ImageInfo[]} images_info 内嵌图片信息
* @property {String} url 原文网址
* @property {String} url_cover 原文头图
* @property {String} url_title 原文标题
* @property {String} url_desc 原文简介
* @property {String} url_host 原文网址的域名
* @property {Number} created_time 创建的 Unix 时间戳
*
* @typedef {Object} Card~ImageInfo
* @property {String} url
* @property {String} format
* @property {String} size
* @property {Number} width
* @property {Number} height
*/
const got = require('@/utils/got');
/**
* @param {String} ctx.params.id
*/
module.exports = async (ctx) => {
const id = ctx.params.id;
const info_res = await got({
method: 'post',
url: 'https://kz.sync163.com/api/topic/info',
headers: {
from: 'h5',
token: 'asdfasdfasdf',
'Content-Type': 'application/json',
},
data: JSON.stringify({
topic_id: id,
}),
});
const info = info_res.data;
const cards_res = await got({
method: 'post',
url: 'https://kz.sync163.com/api/topic/cards',
headers: {
from: 'h5',
token: 'asdfasdfasdf',
'Content-Type': 'application/json',
},
data: JSON.stringify({
topic_id: id,
}),
});
const cardList = cards_res.data.list;
ctx.state.data = {
title: `快知 - ${info.info.name}`,
description: info.info.description,
link: `https://kz.sync163.com/web/topic/${id}`,
image: info.info.icon,
item: cardList.map(buildFeedItem),
};
};
/**
* @param {Card} cardData
*/
const buildFeedItem = (cardData) => {
const description = `
<p><img src="${cardData.url_cover}" /></p>
<p>${cardData.url_title ? cardData.url_title : ''}${cardData.url_desc ? ` - ${cardData.url_desc}` : ''}</p>
<p style="white-space: pre-line">${serializeCardText(cardData.text)}</p>
${renderImageList(cardData.images)}
<p><a href="https://kz.sync163.com/web/card/${cardData.id}" style="margin-left: 10px">快知中间页</a></p>
`;
return {
title: cardData.title ? cardData.title : cardData.url_title,
description,
pubDate: new Date(cardData.created_time * 1000),
link: cardData.url,
};
};
const renderImageList = (images) => {
const renderItem = (src) => `
<li style="width: 30%; margin: 0.5rem">
<img style="width: 100%" src="${src}" />
</li>
`;
return `
<ul style="
display: flex;
justify-content: space-between;
flex-wrap: wrap;
list-style: none;
margin: 0;
padding: 0;
">
${images.map(renderItem).join('')}
</ul>
`;
};
const serializeCardText = (text) =>
text
/* 快知的 API 里的 a 标签名字叫做 a-link ,我们要把它改过来 */
.replace(/<a-link/g, '<a')
.replace(/<\/a-link>/g, '</a>')
/* 替换换行符 */
.replace(/\n/g, '<br>');
-59
View File
@@ -1,59 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const category = ctx.params.category || '';
const rootUrl = 'https://www.makeuseof.com';
const currentUrl = `${rootUrl}${category === '' ? '' : '/category/' + category}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.home-secondary, .listing-content')
.find('.bc-title-link')
.slice(0, 15)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('.img-article-item')
.find('img')
.each(function () {
content(this).attr('src', content(this).prev().attr('data-srcset').split('?')[0]);
});
content('.ad-zone-container, .sharing, .sentinel-article-nextArticle, .article-tags, .w-article-author-bio, .ml-form-embedContainer').remove();
item.description = content('.article-body').html();
item.author = content('a.author').text().replace('By ', '');
item.pubDate = new Date(content('time').attr('datetime')).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: `MakeUseOf - ${$('.listing-title').text() ? $('.listing-title').text() : 'Trending'}`,
link: currentUrl,
item: items,
};
};
-17
View File
@@ -1,17 +0,0 @@
const matatakiUtils = require('@/routes/matataki/utils/matataki-utils');
module.exports = async (ctx) => {
const authorId = ctx.params.authorId;
const ipfsFlag = !!ctx.params.ipfsFlag;
const authorName = await matatakiUtils.getUserNickname(authorId);
const items = await matatakiUtils.getPostsAsFeedItems(`/posts/timeRanking?author=${authorId}`, ipfsFlag);
ctx.state.data = {
title: `瞬Matataki - ${authorName}作品 ${ipfsFlag ? '(IPFS)' : ''}`,
link: `https://www.matataki.io/user/${authorId}`,
description: `瞬Matataki - ${authorName}作品`,
item: items,
};
};
@@ -1,42 +0,0 @@
const matatakiUtils = require('@/routes/matataki/utils/matataki-utils');
module.exports = async (ctx) => {
const userId = ctx.params.userId;
const favoriteListId = ctx.params.favoriteListId;
const ipfsFlag = !!ctx.params.ipfsFlag;
const response = await matatakiUtils.get(`/favorites/post?userId=${userId}&fid=${favoriteListId}&page=1`);
let items;
if (ipfsFlag) {
items = await Promise.all(
response.data.data.list.map(async (item) => {
const ipfsHtmlHash = await matatakiUtils.getPostIpfsHtmlHash(item.pid);
return {
title: item.title,
description: item.short_content,
link: `${matatakiUtils.IPFS_GATEWAY_URL}/ipfs/${ipfsHtmlHash}`,
pubDate: item.create_time,
guid: ipfsHtmlHash,
};
})
);
} else {
items = response.data.data.list.map((item) => ({
title: item.title,
description: item.short_content,
link: `https://www.matataki.io/p/${item.pid}`,
pubDate: item.create_time,
}));
}
const text = `瞬Matataki - ${response.data.data.info.nickname || response.data.data.info.username} 收藏夹 #${response.data.data.info.name}# ${ipfsFlag ? '(IPFS)' : ''}`;
ctx.state.data = {
title: text,
link: `https://www.matataki.io/user/${userId}/favlist?fid=${favoriteListId}`,
description: text,
allowEmpty: true,
item: items,
};
};
@@ -1,15 +0,0 @@
const matatakiUtils = require('@/routes/matataki/utils/matataki-utils');
module.exports = async (ctx) => {
const querystring = ctx.request.querystring;
const ipfsFlag = !!ctx.params.ipfsFlag;
const items = await matatakiUtils.getPostsAsFeedItems(`/posts/scoreRanking?${querystring}`, ipfsFlag);
ctx.state.data = {
title: `瞬Matataki - 热门作品 ${ipfsFlag ? '(IPFS)' : ''}`,
link: `https://www.matataki.io/article/`,
description: `瞬Matataki - 热门作品`,
item: items,
};
};
-16
View File
@@ -1,16 +0,0 @@
const matatakiUtils = require('@/routes/matataki/utils/matataki-utils');
module.exports = async (ctx) => {
const tagId = ctx.params.tagId;
const tagName = ctx.params.tagName;
const ipfsFlag = !!ctx.params.ipfsFlag;
const items = await matatakiUtils.getPostsAsFeedItems(`/posts/getPostByTag?pagesize=20&tagid=${tagId}&extra=short_content&orderBy=hot_score&order=desc&page=1`, ipfsFlag);
ctx.state.data = {
title: `瞬Matataki #${tagName} ${ipfsFlag ? '(IPFS)' : ''}`,
link: `https://www.matataki.io/tags/${tagId}`,
description: `瞬Matataki #${tagName}`,
item: items,
};
};
@@ -1,15 +0,0 @@
const matatakiUtils = require('@/routes/matataki/utils/matataki-utils');
module.exports = async (ctx) => {
const querystring = ctx.request.querystring;
const ipfsFlag = !!ctx.params.ipfsFlag;
const items = await matatakiUtils.getPostsAsFeedItems(`/posts/timeRanking?${querystring}`, ipfsFlag);
ctx.state.data = {
title: `瞬Matataki - 最新作品 ${ipfsFlag ? '(IPFS)' : ''}`,
link: `https://www.matataki.io/article/latest`,
description: `瞬Matataki - 最新作品`,
item: items,
};
};
-18
View File
@@ -1,18 +0,0 @@
const matatakiUtils = require('@/routes/matataki/utils/matataki-utils');
module.exports = async (ctx) => {
const id = ctx.params.id;
const filterCode = ctx.params.filterCode;
const ipfsFlag = !!ctx.params.ipfsFlag;
const tokenName = await matatakiUtils.getTokenName(id);
const items = await matatakiUtils.getPostsAsFeedItems(`/minetoken/${id}/related?filter=${filterCode}&sort=time-desc&onlyCreator=0&page=1`, ipfsFlag);
ctx.state.data = {
title: `瞬Matataki - ${tokenName ? tokenName : 'Fan票'}关联作品 ${ipfsFlag ? '(IPFS)' : ''}`,
link: `https://www.matataki.io/token/${id}/circle`,
description: `瞬Matataki - ${tokenName ? tokenName : 'Fan票'}关联作品`,
allowEmpty: true,
item: items,
};
};
-125
View File
@@ -1,125 +0,0 @@
const got = require('@/utils/got');
/**
* Matataki API 地址
*/
const MTATAKI_API_URL = 'https://api.mttk.net';
/**
* Matataki 官网地址
*/
const MATATAKI_WEB_URL = 'https://www.matataki.io/';
/**
* IPFS网关的URL。可以换成其他公共网关,也可以换成自建的网关地址
*/
const IPFS_GATEWAY_URL = 'https://10.via0.com';
/**
* 以`get` 方式调用Matataki API的简单封装
*
* @param {string} path 以 / 开始
*/
function get(path) {
return got({
method: 'get',
url: MTATAKI_API_URL + path,
headers: {
Referer: MATATAKI_WEB_URL,
},
});
}
/**
* 获取用户信息昵称
*
* @param {number} userId
*/
async function getUserNickname(userId) {
try {
const userInfoResponse = await get(`/user/${userId}`);
return userInfoResponse.data.data.nickname || userInfoResponse.data.data.username;
} catch (err) {
return '';
}
}
/**
* 获取Fan票名称
*
* @param {number} tokenId
*/
async function getTokenName(tokenId) {
try {
const tokenInfoResponse = await get(`/minetoken/${tokenId}`);
return tokenInfoResponse.data.data.token.name;
} catch (err) {
return '';
}
}
/**
* 获取Matataki作品在IPFS上的Hash
*
* @param {number} postId
*/
async function getPostIpfsHtmlHash(postId) {
const ipfsInfoResponse = await get(`/p/${postId}/ipfs`);
return ipfsInfoResponse.data.data[0].htmlHash;
}
/**
* 将Matataki作品条目转为指向IPFS网关的RSS订阅源条目
*
* @param {Object} item
*/
async function postToIpfsFeedItem(item) {
const ipfsHtmlHash = await getPostIpfsHtmlHash(item.id);
return {
title: `${item.title} - ${item.nickname || item.author}${item.token_name ? ' $' + item.token_name : ''}`,
description: item.short_content,
link: `${IPFS_GATEWAY_URL}/ipfs/${ipfsHtmlHash}`,
pubDate: item.create_time,
guid: ipfsHtmlHash,
};
}
/**
* 将Matataki作品条目转为指向官网的RSS订阅源条目
*
* @param {Object} item
*/
function postToFeedItem(item) {
return {
title: `${item.title} - ${item.nickname || item.author}${item.token_name ? ' $' + item.token_name : ''}`,
description: item.short_content,
link: `https://www.matataki.io/p/${item.id}`,
pubDate: item.create_time,
};
}
/**
* 获取作品列表并转为Feed Item数组
*
* @param {string} url Matataki作品相关API的url
* @param {ipfsFlag} ipfsFlag 是否取IPFS地址
*/
async function getPostsAsFeedItems(url, ipfsFlag) {
const response = await get(url);
if (ipfsFlag) {
return Promise.all(response.data.data.list.map(postToIpfsFeedItem));
}
return response.data.data.list.map(postToFeedItem);
}
module.exports = {
IPFS_GATEWAY_URL,
get,
getUserNickname,
getTokenName,
getPostIpfsHtmlHash,
postToIpfsFeedItem,
postToFeedItem,
getPostsAsFeedItems,
};
-54
View File
@@ -1,54 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const iconv = require('iconv-lite');
module.exports = async (ctx) => {
const caty = ctx.params.caty || '';
const rootUrl = 'http://www.mitbbs.com';
const currentUrl = `${rootUrl}/${caty === '' ? 'news/mitbbs_news_zahui.php' : 'news_pg/' + ctx.params.caty + '.html'}`;
const response = await got({
method: 'get',
url: currentUrl,
responseType: 'buffer',
});
const $ = cheerio.load(iconv.decode(response.data, 'gb2312'));
const list = $('tr[align="center"] td a.blue_14p_link, tr[bgcolor="#FFFFFF"] td a.blue_14p_link')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
pubDate: new Date(item.find('div.weinei_left_con_line_date').text() + ' GMT+8').toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
responseType: 'buffer',
});
const content = cheerio.load(iconv.decode(detailResponse.data, 'gb2312'));
const dateTd = content('.black_32p').parent();
dateTd.find('span, p').remove();
item.pubDate = new Date(dateTd.text().trim().replace(/年|月/g, '-').replace('日', ' ')).toUTCString();
item.description = content('table').eq(5).find('table').eq(1).html();
return item;
})
)
);
ctx.state.data = {
title: `未名新闻 - ${caty === '' ? '新闻大杂烩' : $('strong').eq(1).text()}`,
link: currentUrl,
item: items,
};
};
-40
View File
@@ -1,40 +0,0 @@
const got = require('@/utils/got');
const sourceTimezoneOffset = -8;
module.exports = async (ctx) => {
const id_url = 'https://sportsnba.qq.com/news/index?column=banner';
const articles = await got.get(id_url);
const articleIds = articles.data.data.map((article) => article.id);
const url = 'https://sportsnba.qq.com/news/item?column=banner&articleIds=' + articleIds.toString();
const response = await got.get(url);
const xmls = response.data.data;
const out = Object.keys(xmls).map((xml) => {
const data = xmls[xml];
const link = data.shareUrl;
const guid = data.newsId;
const title = data.title;
const time = new Date(data.pub_time);
time.setTime(time.getTime() + (sourceTimezoneOffset - time.getTimezoneOffset() / 60) * 60 * 60 * 1000);
const pubDate = time.toUTCString();
const description = '<img src="' + data.imgurl + '">';
const item = {
title,
description,
pubDate,
link,
guid,
};
return item;
});
ctx.state.data = {
title: 'NBA - news',
link: 'https://kbsapp.sports.qq.com',
item: out,
};
};
-54
View File
@@ -1,54 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const category = ctx.params.category || '';
const rootUrl = 'http://www.northhouse.cc';
const currentUrl = `${rootUrl}${category === '' ? '' : `/category/${category}`}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data.replace(/<div class="clear"><\/div>/g, '<div class="clear"></div><time>').replace(/<div class="contents">/g, '</time><div class="contents">'));
const list = $('.entry h2 a')
.slice(0, 10)
.map((_, item) => {
item = $(item);
const date = item.parent().parent().find('time').text().trim().replace(/月/, '').split(' ');
return {
title: item.text(),
link: item.attr('href'),
pubDate: new Date(`${date[0]} ${date[2]} GMT+8`).toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('.crp_related').remove();
item.description = content('.contents').html();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-54
View File
@@ -1,54 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const id = ctx.params.id || '';
const rootUrl = 'https://www.or123.net';
const currentUrl = `${rootUrl}${id ? `/?page_id=${id}` : ''}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.vc-carousel-slideline-inner')
.eq(0)
.find('.title')
.slice(0, 10)
.map((_, item) => {
item = $(item).parent();
return {
title: item.text(),
link: item.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.qfe_wrapper').eq(4).html();
item.pubDate = timezone(parseDate(detailResponse.data.match(/(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/)[1], 'YYYY-MM-DD HH:mm'), +8);
return item;
})
)
);
ctx.state.data = {
title: `${$('.header_title').eq(0).text()} - OR`,
description: $('.header_subtitle').eq(0).text(),
link: currentUrl,
item: items,
};
};
-49
View File
@@ -1,49 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const rootUrl = 'https://www.partnershiponai.org';
const currentUrl = `${rootUrl}/resources`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('a.grid-box')
.map((_, item) => {
item = $(item);
return {
link: item.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.title = content('title').text().replace(' - The Partnership on AI', '');
item.description = content('.resource-detail-content, .case-study-body').html();
item.pubDate = parseDate(detailResponse.data.match(/"datePublished":"(.*)","dateModified":/)[1]);
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-54
View File
@@ -1,54 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const type = ctx.params.type || '0';
const response = await got({
method: 'post',
url: 'https://www.pintu360.com/service/ajax_article_service.php',
headers: {
Referer: 'https://www.pintu360.com/',
},
form: {
fnName: 'getArticleList',
type: type === '0' ? 'recommend' : 'classId',
id: type,
pageNumber: 0,
duration: 'quarter',
},
});
const data = response.data;
const items = await Promise.all(
data.slice(0, 10).map(async (item) => {
const link = `https://www.pintu360.com/a${item.id}.html?${item.op}`;
return Promise.resolve({
title: item.title,
description: await ctx.cache.tryGet(link, async () => {
const res = await got(link);
const $ = cheerio.load(res.data);
return $('.article-content .text').html();
}),
pubDate: new Date(item.createTime).toUTCString(),
link,
});
})
);
const titleMap = {
0: '推荐',
7: '零售前沿',
10: '智能科技',
9: '泛文娱',
98: '教育',
70: '大健康',
8: '新消费',
72: '创业投资',
};
ctx.state.data = {
title: `品途商业评论-${titleMap[type]}`,
link: type === '0' ? 'https://www.pintu360.com/' : `https://www.pintu360.com/articleList-${type}.html`,
item: items,
};
};
-42
View File
@@ -1,42 +0,0 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const currentDate = new Date();
const year = currentDate.getFullYear();
const url = `https://plainlaw.me/${year}`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('article').get();
const out = await Promise.all(
list.map(async (item) => {
const $ = cheerio.load(item);
const title = $('h3.title > a').text();
const address = $('h3.title > a').attr('href');
const cache = await ctx.cache.get(address);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await got.get(address);
const capture = cheerio.load(res.data);
capture('div.inline-post.clearfix').remove();
const banner = capture('div.hero').html();
const contents = banner + capture('div.dable-content-wrapper').html();
const single = {
title,
description: contents,
link: address,
guid: address,
};
ctx.cache.set(address, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: '法律白話文運動',
link: url,
item: out,
};
};
-56
View File
@@ -1,56 +0,0 @@
const got = require('@/utils/got');
// 样例 链接 : https://www.pmcaff.com/user/profile/Oak7mqnEQJ
const baseUrl = 'https://www.pmcaff.com/user/profile/';
const api_url = 'https://api.pmcaff.com/api/v0/user/user-articles/';
const sizeTitle = 'PMCAFF互联网产品社区';
// 参考 feed.js
module.exports = async (ctx) => {
// 默认 用户 id Oak7mqnEQJ
const userid = ctx.params.userid || 'Oak7mqnEQJ';
const user_article = api_url + userid;
// 直接获取到 json 数据
const response = await got({
method: 'get',
url: user_article,
headers: {
Referer: baseUrl,
},
});
let user_name = '';
const result = [];
response.data.data.forEach((item) => {
const title = item.title;
const guid = item.article_id;
const pubDate = new Date(item.ctime).toUTCString();
const link = item.target_url;
const description = item.content;
const single = {
title,
link,
guid,
pubDate,
description,
};
// 更新用户名
user_name = item.user_profile.name;
result.push(single);
});
ctx.state.data = {
title: user_name + '---' + sizeTitle,
link: baseUrl + userid,
description: 'PMCAFF互联网产品社区 - 产品经理人气组织::专注于互联网产品研究',
item: result,
};
};
-47
View File
@@ -1,47 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'https://getpolarized.io';
const currentUrl = `${rootUrl}/blog`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('h4 a')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
link: `${rootUrl}${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.title = content('h1').text();
item.description = content('section').html();
item.pubDate = new Date(detailResponse.data.match(/<!-- -->(\d{4}-\d{2}-\d{2})<\/h5><nav>/)[1]).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: 'Polar Blog',
link: currentUrl,
item: items,
};
};
-93
View File
@@ -1,93 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
ctx.params.caty = ctx.params.caty || '0';
const rootUrl = 'https://www.popyard.com';
const currentUrl = `${rootUrl}/cgi-mod/threads.cgi?cate=${ctx.params.caty}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('li a')
.slice(0, 15)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}/cgi-mod${item.attr('href').replace('.', '')}`,
author: item.next().text().split('[')[0],
pubDate: new Date(
item
.next()
.text()
.match(/\[(.*)\]/)[1] + 'GMT+8'
).toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
headers: {
Referer: currentUrl,
},
});
const content = cheerio.load(detailResponse.data);
const description = content('#sponser').parent();
const pages = description.parents('p').eq(0).next('p').find('font a');
const subPages = [],
pageLinks = [];
pages.each(function () {
pageLinks.push(`${rootUrl}/cgi-mod${content(this).attr('href').replace('.', '')}`);
});
if (pages.length > 0) {
pageLinks.forEach((link) =>
ctx.cache.tryGet(link, async () => {
const pageResponse = await got({
method: 'get',
url: link,
headers: {
Referer: currentUrl,
},
});
const subContent = cheerio.load(pageResponse.data);
const subDescription = subContent('#sponser').parent();
subContent('#sponser').prev('table').remove();
subContent('#sponser').remove();
subPages.push(subDescription.html());
})
);
}
content('#sponser').prev('table').remove();
content('#sponser').remove();
item.description = description.html() + subPages.join('');
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-52
View File
@@ -1,52 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const parser = require('@/utils/rss-parser');
module.exports = async (ctx) => {
const feed = await parser.parseURL('https://www.sixthtone.com/rss');
const ProcessFeed = (data) => {
const $ = cheerio.load(data);
// 移除广告等内容
$('[class*="advertise-"]').remove();
// 提取内容
return $('.content').html();
};
const items = await Promise.all(
feed.items.map(async (item) => {
const link = 'https:' + item.link.match(/\/\/www.sixthtone.com\/news\/\d+\//g)[0];
const cache = await ctx.cache.get(link);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got({
method: 'get',
url: link,
});
const description = ProcessFeed(response.data);
const single = {
title: item.title,
description,
pubDate: item.pubDate,
link,
author: item.author,
};
ctx.cache.set(link, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: feed.title,
link: feed.link,
description: feed.description,
item: items,
};
};
-29
View File
@@ -1,29 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const currentUrl = `http://hunt.socialbeta.com/`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('div.ml64')
.slice(0, 50)
.map((_, item) => {
item = $(item);
const a = item.find('a');
return {
title: a.text(),
link: a.attr('href'),
description: item.find('div.content').text(),
};
})
.get();
ctx.state.data = {
title: 'SocialBeta - 案例',
link: currentUrl,
item: list,
};
};
-130
View File
@@ -1,130 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const iconv = require('iconv-lite');
module.exports = async (ctx) => {
const category = ctx.params.category;
const lang = ctx.params.language;
let index_url;
let character_set;
switch (lang) {
case 'zh_tw':
index_url = 'http://www.soomal.com/doc/index201000_0001_00.htm';
character_set = 'big5';
break;
case 'en':
index_url = 'http://eng.soomal.com/edoc/index101000_0001_00.htm';
character_set = 'ISO-8859-5';
break;
default:
index_url = 'http://www.soomal.com/doc/index101000_0001_00.htm';
character_set = 'gbk';
break;
}
let category_list;
let url_list;
const category_url = await ctx.cache.tryGet([lang, category], async () => {
const front_page = await got.get(index_url, {
responseType: 'buffer',
});
const front_data = iconv.decode(front_page.data, character_set);
const $ = cheerio.load(front_data);
if (lang !== 'en') {
const container_list = $('div.container.cf').slice(0, 2);
category_list = container_list
.find('ul.ul-reset')
.find('h3')
.children()
.get()
.map((item) => $(item).text());
url_list = container_list
.find('ul.ul-reset')
.find('h3')
.children()
.get()
.map((item) => $(item).attr('href'));
} else {
category_list = $('div.menu')
.find('a')
.get()
.map((item) => $(item).text());
url_list = $('div.menu')
.find('a')
.get()
.map((item) => $(item).attr('href'));
}
return url.resolve(index_url, url_list[category_list.indexOf(category)]);
});
const response = await got.get(category_url, {
responseType: 'buffer',
});
const data = iconv.decode(response.data, character_set);
const $ = cheerio.load(data);
const list = $('div.item')
.find('div.title')
.children('a')
.get()
.map((item) => url.resolve(category_url, $(item).attr('href')));
const out = await Promise.all(
list.map(async (link) => {
const [title, author, pubDate, description] = await ctx.cache.tryGet(link, async () => {
const response = await got.get(link, {
responseType: 'buffer',
});
const data = iconv.decode(response.data, character_set);
const $ = cheerio.load(data);
let [title, author, pubDate, description] = '';
if (lang !== 'en') {
title = $('div.titlebox').find('div.title').text();
author = $('div.titlebox').find('div.info').children('a').text();
pubDate = Date.parse(
$('div.titlebox')
.find('div.info')
.text()
.match(/\d{4}([.\-/ ])\d{2}\1\d{2}\s\d{2}[:]\d{2}[:]\d{2}/)[0]
);
$('div.toolbar,div.grade').remove();
description = $('div.Doc').html();
} else {
title = $('div.titlebox').find('div.title').text();
author = $('div.titlebox').find('div.infobox').children('a').text();
pubDate = new Date();
$('div.grade').remove();
description = $('div.textbox').html();
}
return [title, author, pubDate, description];
});
const item = {
title,
description,
pubDate,
link,
author,
};
return item;
})
);
ctx.state.data = {
title: 'Soomal.com - ' + category,
link: category_url,
item: out,
};
};
-53
View File
@@ -1,53 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'https://www.tam.museum';
const currentUrl = `${rootUrl}/astronomy/forecast.php?lang=tw`;
const response = await got({
method: 'get',
url: currentUrl,
https: {
rejectUnauthorized: false,
},
});
const $ = cheerio.load(response.data);
const list = $('#sample_2 a[title]')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}/astronomy/${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
https: {
rejectUnauthorized: false,
},
});
const content = cheerio.load(detailResponse.data);
item.description = content('.content_detail').html();
item.pubDate = new Date(detailResponse.data.match(/<label>公告日期 : <\/label> (\d{4}-\d{2}-\d{2})/)[1]).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-27
View File
@@ -1,27 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://api.tanwuapp.com/iOS/2.0.0/products?rentType=0&pageSize=1000&pageNum=1&clientType=web:h5',
});
const data = response.data.details.allProductList.data;
ctx.state.data = {
title: '探物',
link: 'https://m.tanwuapp.com',
description: '探物是一个科技数码产品租赁平台,旨在把市面上最新、最酷、最实用的科技产品带去给用户,传播科技便捷生活、共享丰富生活的价值理念。',
item: data.map(({ productName, productImageSrc, productRent, rentUnit, productId, appraiseAvgScore }) => ({
title: productName,
link: `https://m.tanwuapp.com/?source=mobile#/productDetails?productId=${productId}`,
description: `
<img src="${productImageSrc}"><br>
<strong>${productName}</strong><br><br>
价格: ¥${productRent} / ${rentUnit}<br>
评分: ${appraiseAvgScore}
`,
guid: productId,
})),
};
};
-64
View File
@@ -1,64 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const iconv = require('iconv-lite');
const map = new Map([
['lab', { title: '谷雨实验室', link: 'https://news.qq.com/guyu/huizong/hz_lab.htm', channelid: 498 }],
['report', { title: '谷雨报道', link: 'https://news.qq.com/guyu/huizong/hz_report.htm', channelid: 500 }],
['story', { title: '谷雨故事', link: 'https://gy.qq.com/hz_story.html', channelid: 332 }],
['shalong', { title: '谷雨沙龙', link: 'https://news.qq.com/guyu/huizong/hz_shalong.htm', channelid: 542 }],
]);
module.exports = async (ctx) => {
const type = ctx.params.name;
const title = map.get(type).title;
const channelid = map.get(type).channelid;
const link = map.get(type).link;
const api = `https://i.match.qq.com/ninjayc/guyu?action=guyu&channelid=${channelid}&p=0&num=10`;
const response = await got({
method: 'get',
url: api,
headers: { Referer: link },
});
const list = response.data.data;
const out = await Promise.all(
list.map(async (info) => {
const title = info.n_short_title;
const date = info.n_publishtime;
const itemUrl = info.n_url;
const author = info.name;
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(itemUrl, {
responseType: 'buffer',
});
response.data = iconv.decode(response.data, 'gbk');
const $ = cheerio.load(response.data);
const description = $('div.articleContent').html().replace(/src="/g, `src="https:`);
const single = {
title,
link: itemUrl,
description,
author,
pubDate: new Date(date).toUTCString(),
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title,
link,
item: out,
};
};
-67
View File
@@ -1,67 +0,0 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const tag = ctx.params.tag;
const response = await got({
method: 'get',
url: `https://www.thrillist.com/${tag}`,
});
const url = response.url; // got will make sure that this is the final URL after redirects
const data = response.data;
const $ = cheerio.load(data);
const title = $('meta[property="og:title"]').attr('content');
const description = $('meta[property="og:description"]').attr('content');
const list = $('div.golSS > a,div.cAtWxS > a')
.slice(0, 10)
.map((_, item) => {
item = $(item);
const itemURL = new URL(item.attr('href'), url).href;
return {
link: itemURL,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
const body = content('div.hjroUg');
const dateContent = content('p.iNefBF').text();
const dateRegex = dateContent.match(/(\d+\/\d+\/\d+) at (\d+:\d+ [A-Za-z]*)/);
const dateString = dateRegex[1] + ' ' + dateRegex[2];
// // remove extra body content that we don't want to see
body.find('div.article-header__mobile-top-row').remove();
body.find('p.iNefBF').remove();
body.find('h1.ixrfny').remove();
body.find('div.bStUVN').remove();
body.find('span.dgtYLN').remove();
item.title = content('meta[property="og:title"]').attr('content');
item.description = body.html();
item.pubDate = new Date(dateString).toUTCString();
return item;
})
)
);
ctx.state.data = {
title,
link: url,
description,
item: items,
};
};
-41
View File
@@ -1,41 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const type = ctx.params.type;
let url = `https://www.tuicool.com/mags/${type}`;
if (type === 'prog') {
url = 'https://www.tuicool.com/mags';
}
const res = await got({
method: 'get',
url,
});
url = 'https://www.tuicool.com' + cheerio.load(res.data)('.mag-period-item a').attr('href');
const response = await got({
method: 'get',
url,
});
const $ = cheerio.load(response.data);
const list = $('.article-title');
ctx.state.data = {
title: $('title').text(),
link: 'https://www.tuicool.com/',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('.title').text(),
description: `推酷:${item.find('.title').text()}`,
pubDate: new Date($('.period-title sub').text().substring(1, 11)).toUTCString(),
link: String(item.find('a').attr('href')),
};
})
.get(),
};
};
-54
View File
@@ -1,54 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'https://www.voanews.com';
const currentUrl = `${rootUrl}/day-photos`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.teaser__title-link')
.slice(0, 15)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('img').each(function () {
content(this).attr('src', content(this).attr('data-src'));
content(this).removeAttr('data-src');
});
content('noscript').remove();
item.description = content('.multimedia-gallery__items').html();
item.pubDate = new Date(content('.page-header__meta-item').text()).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-43
View File
@@ -1,43 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = 'https://m.whalegogo.com/index';
const response = await got.get('https://api.whalegogo.com/v1/app/index');
const list = response.data.items;
const out = await Promise.all(
list.map(async (info) => {
const title = info.title;
const date = info.push_at;
const id = info.id;
const cid = info.cid;
const author = info.author.username;
const itemUrl = `https://m.whalegogo.com/article?id=${id}&cid=${cid}`;
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(`https://api.whalegogo.com/v1/articles/${id}?expand=content`);
const description = response.data.content;
const single = {
title,
author,
link: itemUrl,
description,
pubDate: new Date(date * 1000).toUTCString(),
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: '鲸跃汽车',
link: url,
item: out,
};
};
-57
View File
@@ -1,57 +0,0 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const type_id = ctx.params.type_id || '2';
const tagid = ctx.params.tagid || '';
const sort = ctx.params.sort || '-push_at';
const url = `https://www.whalegogo.com/list/portal-${type_id}?tag_id=all`;
// type_id = 2:快讯 / 1:文章 / 7:活动 / 8:评测
// tagid = 70:视频 /73:访谈
// sort = -push_at 最新 / hot最热
const response = await got({
method: 'get',
url: `https://api.whalegogo.com/v1/articles/search?tagid=${tagid}&type_id=${type_id}&sort=${sort}&page=1&per-page=12`,
headers: {
Referer: url,
},
});
const list = response.data.items;
const out = await Promise.all(
list.map(async (info) => {
const title = info.title;
const date = info.push_at;
const id = info.id;
// const cid = info.cid;
const author = info.author.username;
const itemUrl = `https://www.whalegogo.com/news?id=${id}`;
const cache = await ctx.cache.get(itemUrl);
// console.log(cid);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got({
method: 'get',
url: `https://api.whalegogo.com/v1/articles/${id}?expand=content`,
headers: {
Referer: url,
},
});
const description = response.data.content;
const single = {
title,
author,
link: itemUrl,
description,
pubDate: new Date(date * 1000).toUTCString(),
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: '鲸跃汽车',
link: url,
item: out,
};
};
-33
View File
@@ -1,33 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const url = require('url');
const host = 'http://www.xici.net/t/';
module.exports = async (ctx) => {
const id = ctx.params.id || '..';
const link = url.resolve(host, id);
const response = await got.get(link);
const $ = cheerio.load(response.data);
const title = $('a.actived').text();
const out = $('ul.feed-list li[data-score]')
.slice(0, 10)
.map(function () {
const info = {
title: $(this).find('div.title a').text(),
link: 'http:' + $(this).find('div.title a').attr('href'),
pubDate: $(this).find('span.time').attr('data-timeago'),
author: $(this).find('a.board-link').text(),
};
return info;
})
.get();
ctx.state.data = {
title: `${title}-西祠胡同`,
link,
item: out,
};
};
-52
View File
@@ -1,52 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const iconv = require('iconv-lite');
module.exports = async (ctx) => {
const rootUrl = 'http://yicas.cn';
const currentUrl = `${rootUrl}/portal.php?mod=blog`;
const response = await got({
method: 'get',
url: currentUrl,
responseType: 'buffer',
});
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
const list = $('tr td a[title]')
.slice(0, 15)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: item.attr('href'),
pubDate: new Date(item.next().text()).toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
responseType: 'buffer',
});
const content = cheerio.load(iconv.decode(detailResponse.data, 'gbk'));
item.author = content('.xs2').text();
item.description = content('#blog_article').html();
item.pubDate = new Date(content('.xg1').eq(5).text()).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-33
View File
@@ -1,33 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const url = 'http://www.yidoutang.com/';
const response = await got(url);
const $ = cheerio.load(response.data);
const items = $('.main > .article')
.map((_, ele) => {
const $item = cheerio.load(ele);
const baseInfoNode = $item('.title > a');
const title = baseInfoNode.text();
const link = baseInfoNode.attr('href');
const thumbnail = $item('.article > a > img').attr('delayload');
const desc = $item('.abstract').text();
const tip = $item('.tip').text();
const author = $item('.avatar a').text();
return {
title,
link,
description: [`分类: ${tip}`, `简介: ${desc}`, `<img src="${thumbnail}"/>`].join('<br/>'),
author,
};
})
.get();
ctx.state.data = {
title: '一兜糖 - 精选',
description: '一兜糖 - 精选',
link: url,
item: items,
};
};
-36
View File
@@ -1,36 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const boardId = ctx.params.boardId;
const sortType = ctx.query.sortType || 'byCtime';
const response = await got({
method: 'get',
url: `https://www.zfrontier.com/board/${boardId}?sort=${sortType}&page=1`,
});
const data = response.data;
const $ = cheerio.load(data);
const boardTitle = $('.board-head-area h1').text();
const list = $('.post-entry');
ctx.state.data = {
title: `${boardTitle} - 贴子列表 - zFrontier装备前线`,
link: response.url,
description: 'zFrontier 发烧友的最前线',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('.post-title h2').text(),
description: `${item.find('.ellipsis').html()}<br/>${item.find('.imgs-wrap').html()}`,
link: `https://www.zfrontier.com${item.find('.post-title').attr('href')}`,
author: item.find('.author a').text(),
pubDate: new Date(item.find('.time').text()).toLocaleDateString(),
};
})
.get(),
};
};
-33
View File
@@ -1,33 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const type = ctx.params.type || 'byReplyTime';
const response = await got({
method: 'get',
url: `https://www.zfrontier.com/?sort=${type}&page=1`,
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('.post-entry');
ctx.state.data = {
title: `${type}贴子列表 - zFrontier装备前线`,
link: response.url,
description: 'zFrontier 发烧友的最前线',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('.post-title h2').text(),
description: `${item.find('.ellipsis').html()}<br/>${item.find('.imgs-wrap').html()}`,
link: `https://www.zfrontier.com${item.find('.post-title').attr('href')}`,
author: item.find('.author a').text(),
pubDate: new Date(item.find('.time').text()).toLocaleDateString(),
};
})
.get(),
};
};
-59
View File
@@ -1,59 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const category = ctx.params.category || 'all';
const language = ctx.params.language || '';
const rootUrl = 'https://www.z-z-z.vip';
const currentUrl = `${rootUrl}${language ? `/${language}` : ''}/${category === 'all' ? '' : `post/category/${category}`}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('.blog-entry-title a')
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: item.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('amp-img').each(function () {
content(this)
.parent()
.append(`<img src="${content(this).attr('src')}">`);
});
content('amp-img').remove();
item.description = content('.entry-content').html();
item.pubDate = new Date(detailResponse.data.match(/"datePublished":"(.*)","dateModified"/)[1]);
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
+1 -1
View File
@@ -2,7 +2,7 @@ const cheerio = require('cheerio');
const ProcessFeed = (data) => {
const $ = cheerio.load(data);
const content = $('div.post-body');
const content = $('div.post-content');
const cover = $('meta[property="og:image"]');
if (cover.length > 0) {
+1 -1
View File
@@ -29,7 +29,7 @@ const getData = async (ctx, list) => {
const article = data.props.pageProps.article;
const capture = cheerio.load(article.body);
const banner = article.thumbnail.urls.header;
const banner = article.thumbnail?.urls?.header;
capture('p.pullquote').remove();
const authorsBio = article.authors.map((author) => '<p>' + author.displayName + author.authorBio.replace(/^<p>/g, ' ')).join('');
-1
View File
@@ -1,5 +1,4 @@
module.exports = {
'/topic/:topic': ['TonyRL'],
'/topic_list': ['TonyRL'],
'/:category?': ['TonyRL'],
};
-6
View File
@@ -14,12 +14,6 @@ module.exports = {
source: ['/', '/topic'],
target: '/agirls/topic_list',
},
{
title: '精选主题',
docs: 'https://docs.rsshub.app/routes/new-media##dian-ta-shao-nu',
source: ['/topic/:topic'],
target: '/agirls/topic/:topic',
},
],
},
};
-1
View File
@@ -1,5 +1,4 @@
module.exports = function (router) {
router.get('/topic/:topic', require('./topic'));
router.get('/topic_list', require('./topic_list'));
router.get('/:category?', require('./index'));
};
-44
View File
@@ -1,44 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { baseUrl, parseArticle } = require('./utils');
module.exports = async (ctx) => {
const { topic } = ctx.params;
const link = `${baseUrl}/topic/${topic}`;
const response = await got({
url: link,
headers: {
Referer: baseUrl,
},
});
const $ = cheerio.load(response.data);
const ldJson = JSON.parse($('script[type="application/ld+json"]').text());
let items = $('.ag-post-item__link')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.text().trim(),
link: `${baseUrl}${item.attr('href')}`,
};
});
items = await Promise.all(items.map((item) => ctx.cache.tryGet(item.link, () => parseArticle(item, link, undefined))));
ctx.state.data = {
title: $('head title').text().trim(),
link,
description: ldJson['@graph'][0].description,
item: items,
language: $('html').attr('lang'),
};
ctx.state.json = {
title: $('head title').text().trim(),
link,
description: ldJson['@graph'][0].description,
item: items,
language: $('html').attr('lang'),
};
};
-65
View File
@@ -1,65 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const category = ctx.params.category ?? 'posts';
const rootUrl = 'https://allrecode.com';
const currentUrl = `${rootUrl}/${category}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
let items = $('h3 a')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.text(),
link: item.attr('href'),
};
});
items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.author = content('.author').text();
item.category = content('meta[name="keywords"]').attr('content').split(',');
item.pubDate = timezone(
parseDate(
content('.edit')
.text()
.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}/)
),
+8
);
content('.edit, .shang').remove();
item.description = content('.article-content').html();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-5
View File
@@ -1,5 +0,0 @@
module.exports = {
'/news': ['nczitzk'],
'/recommends': ['nczitzk'],
'/:category?': ['nczitzk'],
};
-35
View File
@@ -1,35 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const rootUrl = 'https://allrecode.com';
const currentUrl = `${rootUrl}/news`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const items = $('.news-trigger')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.text(),
link: item.attr('href'),
pubDate: timezone(parseDate(item.parent().prev().text(), 'HH:mm'), +8),
description: item.parent().next().html(),
};
});
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};
-25
View File
@@ -1,25 +0,0 @@
module.exports = {
'allrecode.com': {
_name: '重构',
'.': [
{
title: '推荐',
docs: 'https://docs.rsshub.app/routes/news-media#chong-gou-tui-jian',
source: ['/recommends', '/'],
target: '/allrecode/recommends',
},
{
title: '快讯',
docs: 'https://docs.rsshub.app/routes/news-media#chong-gou-kuai-xun',
source: ['/news', '/'],
target: '/allrecode/news',
},
{
title: '资讯',
docs: 'https://docs.rsshub.app/routes/news-media#chong-gou-zi-xun',
source: ['/:category', '/'],
target: '/allrecode/:category',
},
],
},
};
-4
View File
@@ -1,4 +0,0 @@
module.exports = function (router) {
router.get('/news', require('./news'));
router.get('/:category?', require('./index'));
};
-54
View File
@@ -1,54 +0,0 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const timezone = require('@/utils/timezone');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const type = ctx.params.type ?? '';
const rootUrl = 'https://www.baijingapp.com';
const currentUrl = `${rootUrl}/article${type ? `/type-${type}` : ''}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
let items = $('.article')
.toArray()
.map((item) => {
item = $(item);
return {
title: item.text(),
link: `${rootUrl}${item.attr('href')}`,
};
});
items = await Promise.all(
items.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.author = content('.name').text();
item.description = content('#message').html();
item.pubDate = timezone(parseDate(content('.timeago').text()), +8);
return item;
})
)
);
ctx.state.data = {
title: `白鲸出海 - ${$('.list .active').text()}`,
link: currentUrl,
item: items,
};
};
-3
View File
@@ -1,3 +0,0 @@
module.exports = {
'/:type?': ['nczitzk'],
};
-22
View File
@@ -1,22 +0,0 @@
module.exports = {
'baijingapp.com': {
_name: '白鲸出海',
'.': [
{
title: '最新',
docs: 'https://docs.rsshub.app/routes/new-media#bai-jing-chu-hai',
source: ['/article', '/'],
target: '/baijing',
},
{
title: '资讯',
docs: 'https://docs.rsshub.app/routes/new-media#bai-jing-chu-hai',
source: ['/article', '/'],
target: (params, url) => {
const matches = String(new URL(url)).match(/\/article\/type-(\d+)/);
return `/baijing${matches ? `/${matches[1]}` : ''}`;
},
},
],
},
};
-3
View File
@@ -1,3 +0,0 @@
module.exports = function (router) {
router.get('/:type?', require('./index'));
};
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = async (ctx) => {
const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
ctx.cache.tryGet(item.id, async () => {
const detailResponse = await got({
method: 'post',
url: 'https://app.dahecube.com/napi/news/pc/artinfo',

Some files were not shown because too many files have changed in this diff Show More