Merge branch 'master' into eventernote

This commit is contained in:
Henry Wang 2020-10-10 15:30:09 +01:00 committed by GitHub
commit 8c595b73cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 1112 additions and 156 deletions

View File

@ -32,7 +32,7 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以
### Special Sponsors
<div>
<a href="https://rixcloud.app/rsshub" target="_blank"><img height="60px" src="https://i.imgur.com/TrgP3S1.png"></a>
<a href="https://rixcloud.app/rsshub" target="_blank"><img height="60px" src="https://i.imgur.com/TrgP3S1.png"></a>&nbsp;&nbsp;&nbsp;<a href="https://km.bytell.cn/wxcollect" target="_blank"><img height="60px" src="https://i.imgur.com/7sNM1yi.png"></a>
</div>
### Sponsors

View File

@ -25,7 +25,7 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以
### Special Sponsors
<a style="margin-right: 10px;" href="https://rixcloud.app/rsshub" target="_blank"><img alt="rixCloud" height="60px" src="https://cn-south-17-rsshub-16857749.oss.dogecdn.com/rixcloud.png"></a>
<a style="margin-right: 10px;" href="https://rixcloud.app/rsshub" target="_blank"><img alt="rixCloud" height="60px" src="https://cn-south-17-rsshub-16857749.oss.dogecdn.com/rixcloud.png"></a><a style="margin-right: 10px;" href="https://km.bytell.cn/wxcollect" target="_blank"><img alt="知拾收藏" height="60px" src="https://cn-south-17-rsshub-16857749.oss.dogecdn.com/bytell.png"></a>
### Sponsors

View File

@ -178,6 +178,12 @@ pageClass: routes
<Route author="liyefox" example="/v2ex/tab/hot" path="/v2ex/tab/:tabid" :paramsDesc="['tab标签ID,在 URL 可以找到']"/>
## 巴哈姆特電玩資訊站
### 熱門推薦
<Route author="nczitzk" example="/gamer/hot/47157" path="/gamer/hot/:bsn" :paramsDesc="['板块 id在 URL 可以找到']"/>
## 才符
### 用户动态
@ -248,6 +254,26 @@ pageClass: routes
</Route>
## 华为心声社区
### 华为家事
<Route author="nczitzk" example="/huawei/xinsheng" path="/huawei/xinsheng/:caty?/:order?/:keyword?" :paramsDesc="['分区 ID, 见下表,默认为全部帖子', '排序方式, 见下表,默认为最新回复', '关键词,默认为空']">
分区 ID
| 全部帖子 | 公司文件 | 管理思考 | 产品改进 | 版务公告 |
| -------- | -------- | -------- | -------- | -------- |
| | 155 | 415 | 427 | 419 |
排序方式
| 最新发帖 | 最新回复 | 最多回复 | 最多点击 |
| -------- | -------- | ---------- | --------- |
| cTime | rTime | replycount | viewcount |
</Route>
## 看雪
### 论坛

View File

@ -20,7 +20,7 @@ pageClass: routes
### User Works
<Route author="MisteryMonster" example="/behance/mishapetrick" path="/behance/:user" :paramsDesc="['用户名']" radar="1">
<Route author="MisteryMonster" example="/behance/mishapetrick" path="/behance/:user/:type?" :paramsDesc="['用户名', '类型,可选 `projects``appreciated`']" radar="1">
Behance 用户主页 URL 获取用户名,如 <https://www.behance.net/mishapetrick> 的用户名为 `mishapetrick`

View File

@ -23,7 +23,7 @@ RSSHub delivers millions of contents aggregated from all kinds of sources, our v
### Special Sponsors
<a style="margin-right: 10px;" href="https://rixcloud.app/rsshub" target="_blank"><img height="60px" src="https://i.imgur.com/TrgP3S1.png"></a>
<a style="margin-right: 10px;" href="https://rixcloud.app/rsshub" target="_blank"><img height="60px" src="https://i.imgur.com/TrgP3S1.png"></a><a style="margin-right: 10px;" href="https://km.bytell.cn/wxcollect" target="_blank"><img height="60px" src="https://i.imgur.com/7sNM1yi.png"></a>
### Sponsors

View File

@ -20,7 +20,7 @@ Some tags are rarely used `Script`, `direction`, `production`, `design-concep
### User Works
<RouteEn author="MisteryMonster" example="/behance/mishapetrick" path="/behance/:user" :paramsDesc="['username']" radar="1">
<RouteEn author="MisteryMonster" example="/behance/mishapetrick" path="/behance/:user/:type?" :paramsDesc="['username', 'type, `projects` or `appreciated`, `projects` by default']" radar="1">
Behance user's profile URL, like <https://www.behance.net/mishapetrick> the username will be `mishapetrick`

View File

@ -15,3 +15,9 @@ pageClass: routes
### Security Council Vetoed a Resolution
<RouteEn author="HenryQW" example="/un/scveto" path="/un/scveto"/>
## World Trade Organization
### Dispute settlement news
<RouteEn author="nczitzk" example="/wto/dispute-settlement" path="/wto/dispute-settlement/:year?" :paramsDesc="['Year, current year by default']"/>

View File

@ -4,6 +4,37 @@ pageClass: routes
# Scientific Journal
## Academy of Management
### Journal
<RouteEn author="nczitzk" example="/aom/journal/amr" path="/aom/journal/:id" :paramsDesc="['journal id, see below']">
| Id | Title |
| --------- | ------------------------------------------ |
| annals | Academy of Management Annals |
| amd | Academy of Management Discoveries |
| amgblproc | Academy of Management Global Proceedings |
| amj | Academy of Management Journal |
| amle | Academy of Management Learning & Education |
| amp | Academy of Management Perspectives |
| amproc | Academy of Management Proceedings |
| amr | Academy of Management Review |
</RouteEn>
## arXiv
### Search Keyword
<RouteEn author="nczitzk" example="/arxiv/search_query=all:electron&start=0&max_results=10" path="/arxiv/:query" :paramsDesc="['query statement']" anticrawler="1">
See [arXiv API User Manual](https://arxiv.org/help/api/user-manual) to find out all query statements.
Fill in parameter `query` with content after `http://export.arxiv.org/api/query?`.
</RouteEn>
## Cell Journal
<RouteEn author="yech1990" example="/cell/cell/current" path="/cell/cell/:category" supportScihub="1" />

View File

@ -4,6 +4,12 @@ pageClass: routes
# Application Updates
## Anki
### Changes
<Route author="nczitzk" example="/anki/changes" path="/anki/changes"/>
## Apkpure
### Versions

View File

@ -4,6 +4,20 @@ pageClass: routes
# News
## ABC News
### Site
<Route author="nczitzk" example="/abc" path="/abc/:site?" :paramsDesc="['Site, see below']">
Site
| Just In | Politics | World | Business | Analysis | Sport | Science | Health | Arts | Fact Check | 中文新闻 | Berita Bahasa Indonesia | Tok Pisin |
| - | - | - | - | - | - | - | - | - | - | - | - | - | - |
| justin | politics | world | business | analysis-and-opinion | sport | science | health | arts-culture | factcheck | chinese | indonesian | tok-pisin |
</Route>
## AP News
### Topics

View File

@ -254,16 +254,18 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
## 巴哈姆特
### GNN 新
### GNN 新
<Route author="Arracc" example="/gamer/gnn/1" path="/gamer/gnn/:category?" :paramsDesc="['分类']">
<Route author="Arracc" example="/gamer/gnn/1" path="/gamer/gnn/:category?" :paramsDesc="['版块']">
暂无图片
| 首页 | PC | TV 掌機 | 手機遊戲 | 動漫畫 | 主題報導 | 活動展覽 | 電競 |
| 首頁 | PC | TV 掌機 | 手機遊戲 | 動漫畫 | 主題報導 | 活動展覽 | 電競 |
| ---- | -- | ------- | -------- | ------ | -------- | -------- | ---- |
| 缺省 | 1 | 3 | 4 | 5 | 9 | 11 | 13 |
| Switch | PS5 | PS4 | XboxOne | XboxSX | PC 單機 | PC 線上 | iOS | Android | Web | 漫畫 | 動畫 |
| ------ | --- | --- | ------- | ------ | ------- | ------- | --- | ------- | --- | ----- | ----- |
| ns | ps5 | ps4 | xbone | xbsx | pc | olg | ios | android | web | comic | anime |
</Route>
## 二柄 APP
@ -466,6 +468,18 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
</Route>
## 原神
### 新闻
<Route author="nczitzk" example="/yuanshen" path="/yuanshen/:location?/:category?" :paramsDesc="['区域,可选 zh_CN 或 zh_TW', '分类,见下表,默认为最新']">
| 最新 | 新闻 | 公告 | 活动 |
| ------ | ---- | ------ | -------- |
| latest | news | notice | activity |
</Route>
## 掌上英雄联盟
### 推荐

View File

@ -89,6 +89,12 @@ pageClass: routes
<Route author="sgqy" example="/go.jp/mofa" path="/go.jp/mofa"/>
## 世界贸易组织
### 争端解决新闻
<Route author="nczitzk" example="/wto/dispute-settlement" path="/wto/dispute-settlement/:year?" :paramsDesc="['年份,默认为当前年份']"/>
## 苏州市人民政府
### 政府新闻

View File

@ -4,6 +4,25 @@ pageClass: routes
# 科学期刊
## Academy of Management
### Journal
<Route author="nczitzk" example="/aom/journal/amr" path="/aom/journal/:id" :paramsDesc="['期刊 id见下表']" supportScihub="1">
| Id | 名称 |
| --------- | ------------------------------------------ |
| annals | Academy of Management Annals |
| amd | Academy of Management Discoveries |
| amgblproc | Academy of Management Global Proceedings |
| amj | Academy of Management Journal |
| amle | Academy of Management Learning & Education |
| amp | Academy of Management Perspectives |
| amproc | Academy of Management Proceedings |
| amr | Academy of Management Review |
</Route>
## arXiv
### 搜索关键字
@ -123,7 +142,7 @@ pageClass: routes
### 最新文章(可筛选领域)
<Route author="emdoe yech1990" example="/pnas/Applied Mathematics" path="/pnas/:topic" :paramsDesc="['领域名称','可从 pnas.org 获得']" />
<Route author="emdoe yech1990" example="/pnas/Applied Mathematics" path="/pnas/:topic" :paramsDesc="['领域名称','可从 pnas.org 获得']" supportScihub="1"/>
- 通过 `/pnas/` + “领域名称” 来获取对应 “领域” 的最新文章Latest Research
若参数置空(`/pnas`)或为 latest`/pnas/latest`),则默认获取全部文章。

View File

@ -477,6 +477,18 @@ Supported sub-sites:
<Route author="hillerliao" example="/8btc/news/flash" path="/8btc/news/flash"/>
## 八阕
### 广角新闻
<Route author="nczitzk" example="/popyard" path="/popyard/:caty?" :paramsDesc="['分类, 默认为全景']">
| 全景 | 中国 | 国际 | 科教 | 军事 | 体育 | 娱乐 | 艺术 | 文史 | 观点 | 生活 | 产经 | 其它 |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
</Route>
## 百度知道日报
### 精选

View File

@ -625,6 +625,12 @@ type 为 all 时category 参数不支持 cost 和 free
<Route author="nczitzk" example="/szse/rule" path="/szse/rule"/>
## 守望先锋
### 补丁说明
<Route author="nczitzk" example="/ow/patch" path="/ow/patch"/>
## 四川省科学技术厅
### 四川省科学技术厅 - 公示公告

View File

@ -14,6 +14,12 @@ pageClass: routes
</Route>
## Anki
### Changes
<Route author="nczitzk" example="/anki/changes" path="/anki/changes"/>
## Apkpure
### Versions

View File

@ -298,6 +298,12 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
<Route author="maple3142" example="/facebook/page/SonetPCR" path="/facebook/page/:id" :paramsDesc="['專頁 id']" anticrawler="1"/>
## iCity
### 用户动态
<Route author="nczitzk" example="/icity/sai" path="/icity/:id" :paramsDesc="['用户 id']"/>
## Keep
### 运动日记
@ -928,7 +934,7 @@ rule
### 用户回答
<Route author="DIYgod" example="/zhihu/people/answers/diygod" path="/zhihu/people/answers/:id" :paramsDesc="['作者 id, 可在用户主页 URL 中找到']" anticrawler="1" radar="1"/>
<Route author="DIYgod prnake" example="/zhihu/people/answers/diygod" path="/zhihu/people/answers/:id" :paramsDesc="['作者 id, 可在用户主页 URL 中找到']" anticrawler="1" radar="1"/>
### 用户文章

View File

@ -10,6 +10,20 @@ pageClass: routes
<Route author="brilon" example="/21caijing/channel/readnumber" path="/21caijing/channel/:name" :paramsDesc="['频道名称,可在[https://m.21jingji.com/](https://m.21jingji.com/)页面URL中找到']"/>
## ABC News
### 子站
<Route author="nczitzk" example="/abc/chinese" path="/abc/:site?" :paramsDesc="['子站,见下表']">
子站
| Just In | Politics | World | Business | Analysis | Sport | Science | Health | Arts | Fact Check | 中文新闻 | Berita Bahasa Indonesia | Tok Pisin |
| ------- | -------- | ----- | -------- | -------------------- | ----- | ------- | ------ | ------------ | ---------- | -------- | ----------------------- | --------- |
| justin | politics | world | business | analysis-and-opinion | sport | science | health | arts-culture | factcheck | chinese | indonesian | tok-pisin |
</Route>
## AP News
### 话题
@ -245,6 +259,8 @@ Category 列表:
<Route author="Arracc" example="/yomiuri/news" path="/yomiuri/:category" :paramsDesc="['分类']">
无料全文,综合页添加分类标签,可用于过滤。
| 総合 | 社会 | 政治 | 経済 | スポーツ | 国際 | 科学・IT | 選挙・世論調査 | エンタメ・文化 | 囲碁・将棋 | ライフ | 地域 | 社説 |
| ---- | -------- | -------- | ------- | -------- | ----- | ---------- | -------------- | -------------- | ---------- | ------ | ----- | --------- |
| news | national | politics | economy | sports | world | science | election | culture | igoshougi | life | local | editorial |
@ -571,6 +587,18 @@ category 对应的关键词有
</Route>
## 台湾中央通讯社
### 分类
<Route author="nczitzk" example="/cna/aall" path="/cna/:id?" :paramsDesc="['分类 id见下表默认为 aall']">
| 即時 | 政治 | 國際 | 兩岸 | 產經 | 證券 | 科技 | 生活 | 社會 | 地方 | 文化 | 運動 | 娛樂 |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| aall | aipl | aopl | acn | aie | asc | ait | ahel | asoc | aloc | acul | aspt | amov |
</Route>
## 网易新闻专栏
### 栏目
@ -779,6 +807,18 @@ category 对应的关键词有
</Route>
## 中山网
### 中山网新闻
<Route author="laampui" example="/zsnews/index/35" path="/zsnews/index/:cateid" :paramsDesc="['类别']">
| 35 | 36 | 37 | 38 | 39 |
| ---- | ---- | ---- | ---- | ---- |
| 本地 | 镇区 | 热点 | 社会 | 综合 |
</Route>
## 中時電子報
### 新聞

View File

@ -144,7 +144,7 @@ const calculateValue = () => {
bearertoken: envs.INITIUM_BEARER_TOKEN,
},
btbyr: {
host: envs.BTBYR_HOST || 'https://bt.byr.cn/',
host: envs.BTBYR_HOST,
cookies: envs.BTBYR_COOKIE,
},
mastodon: {

View File

@ -44,6 +44,10 @@ module.exports = async (ctx, next) => {
}
}
if (!item.pubDate) {
item.pubDate = new Date().toISOString();
}
if (item.enclosure_length) {
const itunes_duration =
Math.floor(item.enclosure_length / 3600) + ':' + (Math.floor((item.enclosure_length % 3600) / 60) / 100).toFixed(2).slice(-2) + ':' + (((item.enclosure_length % 3600) % 60) / 100).toFixed(2).slice(-2);

View File

@ -3069,7 +3069,7 @@ router.get('/touhougarakuta/:language/:type', require('./routes/touhougarakuta')
router.get('/liequtv/room/:id', require('./routes/liequtv/room'));
// Behance
router.get('/behance/:user', require('./routes/behance/index'));
router.get('/behance/:user/:type?', require('./routes/behance/index'));
// furstar.jp
router.get('/furstar/characters/:lang?', require('./routes/furstar/index'));
@ -3163,6 +3163,9 @@ router.get('/shiep/:type', require('./routes/universities/shiep/index'));
router.get('/fjnews/:city/:limit', require('./routes/fjnews/fznews'));
router.get('/fjnews/jjnews', require('./routes/fjnews/jjnews'));
// 中山网新闻
router.get('/zsnews/index/:cateid', require('./routes/zsnews/index'));
// 孔夫子旧书网
router.get('/kongfz/people/:id', require('./routes/kongfz/people'));
router.get('/kongfz/shop/:id/:cat?', require('./routes/kongfz/shop'));
@ -3257,6 +3260,30 @@ router.get('/appsales/:caty?/:time?', require('./routes/appsales/index'));
// CGTN
router.get('/cgtn/top', require('./routes/cgtn/top'));
// Academy of Management
router.get('/aom/journal/:id', require('./routes/aom/journal'));
// 巴哈姆特電玩資訊站
router.get('/gamer/hot/:bsn', require('./routes/gamer/hot'));
// iCity
router.get('/icity/:id', require('./routes/icity/index'));
// Anki
router.get('/anki/changes', require('./routes/anki/changes'));
// ABC News
router.get('/abc/:site?', require('./routes/abc/index.js'));
// 台湾中央通讯社
router.get('/cna/:id?', require('./routes/cna/index'));
// 华为心声社区
router.get('/huawei/xinsheng/:caty?/:order?/:keyword?', require('./routes/huawei/xinsheng/index'));
// 守望先锋
router.get('/ow/patch', require('./routes/ow/patch'));
// MM范
router.get('/95mm/tab/:tab?', require('./routes/95mm/tab'));
router.get('/95mm/tag/:tag', require('./routes/95mm/tag'));
@ -3293,7 +3320,7 @@ router.get('/nobelprize/:caty?', require('./routes/nobelprize/index'));
router.get('/gov/taiwan/mnd', require('./routes/gov/taiwan/mnd'));
// 読売新聞
router.get('/yomiuri/:category?', require('./routes/yomiuri/news'));
router.get('/yomiuri/:category', require('./routes/yomiuri/news'));
// 巴哈姆特
// GNN新闻
@ -3308,4 +3335,13 @@ router.get('/ofweek/news', require('./routes/ofweek/news'));
// eventernote
router.get('/eventernote/actors/:name/:id', require('./routes/eventernote/actors'));
// 八阕
router.get('/popyard/:caty?', require('./routes/popyard/index'));
// 原神
router.get('/yuanshen/:location?/:category?', require('./routes/yuanshen/index'));
// World Trade Organization
router.get('/wto/dispute-settlement/:year?', require('./routes/wto/dispute-settlement'));
module.exports = router;

86
lib/routes/abc/index.js Normal file
View File

@ -0,0 +1,86 @@
const url = require('url');
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
ctx.params.site = ctx.params.site || '';
const rootUrl = 'https://mobile.abc.net.au';
const currentUrl = `${rootUrl}/news/${ctx.params.site}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
$('._3zQMR, .ticker').remove();
const list = $('h3')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: url.resolve(rootUrl, item.parents('a').attr('href') || item.find('a').attr('href')),
};
})
.get();
const items = await Promise.all(
list.map(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('.modal-content').remove();
content('img').each(function () {
content(this).attr('src', content(this).attr('data-src'));
});
let coverImage, contentBody;
if (content('div[data-component="FeatureMedia"]').html() !== null) {
coverImage = content('div[data-component="FeatureMedia"]').html();
} else {
coverImage = content('.view-hero-media').html();
}
if (content('#body').html() !== null) {
contentBody = content('#body').html();
} else {
contentBody = content('.article-text').html();
}
const authorsArray = [];
const authorsMatch = detailResponse.data.match(/author":(.*),"dateModified/);
if (authorsMatch === null) {
authorsArray.push(content('meta[name="DCTERMS.contributor"]').attr('content'));
} else {
const authors = JSON.parse(authorsMatch[1]);
try {
for (const author of authors) {
authorsArray.push(author.name);
}
} catch (e) {
authorsArray.push(authors.name);
}
}
item.description = coverImage + contentBody;
item.pubDate = new Date(content('meta[property="article:published_time"]').attr('content')).toUTCString();
item.author = authorsArray.join(', ');
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: currentUrl,
item: items,
};
};

View File

@ -0,0 +1,39 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const md = require('markdown-it')({
html: true,
});
module.exports = async (ctx) => {
const rootUrl = 'https://changes.ankiweb.net';
const currentUrl = `${rootUrl}/README.md`;
const response = await got({
method: 'get',
url: currentUrl,
});
const html = md.render(response.data.replace(/# Changes in/g, '## Changes in').replace(/### Changes in/g, '## Changes in'));
const $ = cheerio.load(html.replace(/<h2>/g, '</div><div><h2>'));
const items = $('div')
.slice(0, 20)
.map((_, item) => {
item = $(item);
const h2 = item.find('h2');
const match = item.find('p').text().match('Released (.*).');
h2.remove();
return {
title: h2.text(),
description: item.html(),
link: `${rootUrl}/#/?id=changes-in-${h2.text().toLowerCase().split(' ').join('-').replace(/\./g, '')}`,
pubDate: match ? new Date(match[1].split(',')[0] + ' GMT+8').toUTCString() : '',
};
})
.get();
ctx.state.data = {
title: 'Changes - Anki',
link: rootUrl,
item: items,
};
};

108
lib/routes/aom/journal.js Normal file
View File

@ -0,0 +1,108 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const rootUrl = 'https://journals.aom.org';
const config = {
annals: {
title: 'Academy of Management Annals',
link: `${rootUrl}/journal/annals`,
},
amd: {
title: 'Academy of Management Discoveries',
link: `${rootUrl}/journal/amd`,
},
amgblproc: {
title: 'Academy of Management Global Proceedings',
link: `${rootUrl}/toc/amgblproc/current`,
},
amj: {
title: 'Academy of Management Journal',
link: `${rootUrl}/journal/amj`,
},
amle: {
title: 'Academy of Management Learning & Education',
link: `${rootUrl}/journal/amle`,
},
amp: {
title: 'Academy of Management Perspectives',
link: `${rootUrl}/journal/amp`,
},
amproc: {
title: 'Academy of Management Proceedings',
link: `${rootUrl}/toc/amproc/current`,
},
amr: {
title: 'Academy of Management Review',
link: `${rootUrl}/toc/amr/0`,
},
};
module.exports = async (ctx) => {
const cfg = config[ctx.params.id];
if (!cfg) {
throw Error('Bad id. See <a href="https://docs.rsshub.app/journal.html#academy-of-management-journal">docs</a>');
}
const currentUrl = cfg.link;
const firstResponse = await got({
method: 'get',
url: rootUrl,
});
const headers = {
cookie: `JSESSIONID=${firstResponse.headers['set-cookie'].join(' ').match(/JSESSIONID=(\S+);/)[1]}`,
};
const response = await got({
method: 'get',
url: currentUrl,
headers,
});
const $ = cheerio.load(response.data);
$('div[data-widget-def="topContentActionWidget"]').eq(2).remove();
$('div[data-widget-def="topContentActionWidget"]').eq(1).remove();
const list = $('h5')
.not('.border-top')
.map((_, item) => {
item = $(item);
const a = item.parent().get(0).tagName === 'a' ? item.parent() : item.find('a');
return {
title: a.attr('title'),
link: `${rootUrl}${a.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
headers,
});
const content = cheerio.load(detailResponse.data);
content('.author-info').remove();
item.author = content('.loa-accordion').text();
item.doi = content('meta[name="dc.Identifier"]').attr('content');
item.description = content('.abstractInFull').html();
item.pubDate = new Date(content('meta[name="dc.Date"]').attr('content')).toUTCString();
return item;
})
)
);
ctx.state.data = {
title: cfg.title,
link: currentUrl,
item: items,
};
};

View File

@ -1,26 +1,34 @@
const ProcessImage = ($, e, c) => {
const cheerio = require('cheerio');
const ProcessImage = ($, e, c, noscript = false) => {
const img = $(e).find(c);
if (img.length > 0) {
let message;
// special handling for img wrapped in <noscript>
if (noscript) {
// eslint-disable-next-line no-unused-vars
const i = cheerio.load(img[0].children[0].data)('img')[0];
// handle cover image and lazy-loading images
if (img[0].attribs.src) {
message = `<figure><img alt='${img[0].attribs.alt ? img[0].attribs.alt : ''}' src='${img[0].attribs.src.replace(/(?<=\/news\/).*?(?=\/cpsprodpb)/, '600')}'><br><figcaption>`;
message = `<figure><img alt='${i.attribs.alt}' src='${i.attribs.src}'><br><figcaption>`;
} else {
message = `<figure><img alt='${img[0].attribs['data-alt'] ? img[0].attribs['data-alt'] : ''}' src='${img[0].attribs['data-src'].replace(/(?<=\/news\/).*?(?=\/cpsprodpb)/, '600')}'><br><figcaption>`;
}
if (img[0].attribs.src) {
// handle cover image and lazy-loading images
message = `<figure><img alt='${img[0].attribs.alt ? img[0].attribs.alt : ''}' src='${img[0].attribs.src.replace(/(?<=\/news\/).*?(?=\/cpsprodpb)/, '600')}'><br><figcaption>`;
} else {
message = `<figure><img alt='${img[0].attribs['data-alt'] ? img[0].attribs['data-alt'] : ''}' src='${img[0].attribs['data-src'].replace(/(?<=\/news\/).*?(?=\/cpsprodpb)/, '600')}'><br><figcaption>`;
}
// add image caption
const figcaption = $(e).find('.media-caption__text');
if (figcaption.length > 0) {
message += `${$(figcaption[0]).text().trim()}`;
}
// add image caption
const figcaption = $(e).find('.media-caption__text');
if (figcaption.length > 0) {
message += `${$(figcaption[0]).text().trim()}`;
}
// add image copyright
const copyright = $(e).find('.story-image-copyright');
if (copyright.length > 0) {
message += ` ©${$(copyright[0]).text().trim()}`;
// add image copyright
const copyright = $(e).find('.story-image-copyright');
if (copyright.length > 0) {
message += ` ©${$(copyright[0]).text().trim()}`;
}
}
message += '</figcaption></figure>';
@ -108,6 +116,10 @@ const ProcessFeed = ($, link) => {
// handle lazy-loading images
ProcessImage($, e, '.js-delayed-image-load');
ProcessImage($, e, 'div > div > div > img');
ProcessImage($, e, 'div > div > div > noscript', true);
ProcessVideo($, e, 'figure.media-with-caption > div.player-with-placeholder');
$(e).remove();

View File

@ -4,9 +4,11 @@ const dayjs = require('dayjs');
module.exports = async (ctx) => {
const user = ctx.params.user || '';
const type = ctx.params.type || 'projects';
const response = await got({
method: 'get',
url: `https://www.behance.net/${user}/projects`, // 接口只获取12个项目
url: `https://www.behance.net/${user}/${type}`, // 接口只获取12个项目
headers: {
'X-Requested-With': 'XMLHttpRequest',
},
@ -15,6 +17,9 @@ module.exports = async (ctx) => {
const list = data.profile.activeSection.work.projects;
const articledata = await Promise.all(
list.map(async (item) => {
if (type !== 'projects') {
item = item.project;
}
const url = `${item.url}?ilo0=1`;
const cache = await ctx.cache.get(url);
if (cache) {
@ -38,11 +43,16 @@ module.exports = async (ctx) => {
ctx.state.data = {
title: `${data.profile.owner.first_name} ${data.profile.owner.last_name}'s Work`,
link: `${data.profile.owner.url}`,
item: list.map((item, index) => ({
title: `${item.name}`,
description: `${articledata[index].content}`,
link: `${item.url}`,
pubDate: dayjs.unix(item.published_on).format(),
})),
item: list.map((item, index) => {
if (type !== 'projects') {
item = item.project;
}
return {
title: `${item.name}`,
description: `${articledata[index].content}`,
link: `${item.url}`,
pubDate: dayjs.unix(item.published_on).format(),
};
}),
};
};

49
lib/routes/cna/index.js Normal file
View File

@ -0,0 +1,49 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
ctx.params.id = ctx.params.id || 'aall';
const rootUrl = `https://www.cna.com.tw/list/${ctx.params.id}.aspx`;
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const list = $('#jsMainList li a div h2')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: item.parents('a').attr('href'),
pubDate: new Date(item.next().text() + ' GMT+8').toUTCString(),
};
})
.get();
const items = await Promise.all(
list.map(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
const topImage = content('.fullPic').html();
item.description = (topImage === null ? '' : topImage) + content('.paragraph').eq(0).html();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: rootUrl,
item: items,
};
};

View File

@ -61,8 +61,7 @@ const parseDongtai = async (item, ctx) => {
url: itemUrl,
headers: getHeaders(),
});
const message = `<p>` + result.data.data.message + `</p>`;
const message = `<p>` + result.data.data.message.split('\n').join('<br>') + `</p>`;
const picArr = item.picArr.filter((i) => i).map((i) => `<img src="${i}">`); // 若无图片item.picArr=[""]
return message + picArr.join('');
});

View File

@ -4,10 +4,11 @@ const iconv = require('iconv-lite');
module.exports = async (ctx) => {
const currentUrl = 'http://news.creaders.net/headline/';
const response = await got({
method: 'get',
url: currentUrl,
const response = await got.get(currentUrl, {
responseType: 'buffer',
});
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
const list = $('ul.newslist li')
.slice(0, 10)
@ -26,9 +27,8 @@ module.exports = async (ctx) => {
list.map(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const res = await got({
method: 'get',
url: item.link,
const res = await got.get(item.link, {
responseType: 'buffer',
});
const content = cheerio.load(iconv.decode(res.data, 'gbk'));

View File

@ -6,7 +6,7 @@ module.exports = async (ctx) => {
const _ = async (type) => {
const response = await got({
url: `https://m.douban.com/rexxar/api/v2/subject_collection/book_${type}_hot_weekly/items?start=0&count=10`,
url: `https://m.douban.com/rexxar/api/v2/subject_collection/book_${type}/items?start=0&count=10`,
headers: { Referer: referer },
});
return response.data.subject_collection_items;

View File

@ -4,36 +4,37 @@ const cheerio = require('cheerio');
module.exports = async (ctx) => {
const category = ctx.params.category;
let url = '';
let category_name = '';
if (!category) {
let categoryName = '';
const categoryTable = {
1: 'PC',
3: 'TV 掌機',
4: '手機遊戲',
5: '動漫畫',
9: '主題報導',
11: '活動展覽',
13: '電競',
ns: 'Switch',
ps5: 'PS5',
ps4: 'PS4',
xbone: 'XboxOne',
xbsx: 'XboxSX',
pc: 'PC 單機',
olg: 'PC 線上',
ios: 'iOS',
android: 'Android',
web: 'Web',
comic: '漫畫',
anime: '動畫',
};
const mainCategory = ['1', '3', '4', '5', '9', '11', '13'];
if (!category || Object.keys(categoryTable).indexOf(category) < 0) {
url = 'https://gnn.gamer.com.tw/';
category_name = '首页';
} else {
url = `https://gnn.gamer.com.tw/index.php?k=${category}`;
switch (category) {
case '1':
category_name = 'PC';
break;
case '3':
category_name = 'TV 掌機';
break;
case '4':
category_name = '手機遊戲';
break;
case '5':
category_name = '動漫畫';
break;
case '9':
category_name = '主題報導';
break;
case '11':
category_name = '活動展覽';
break;
case '13':
category_name = '電競';
break;
default:
category_name = '首页';
categoryName = '-' + categoryTable[category];
if (mainCategory.indexOf(category) > -1) {
url = `https://gnn.gamer.com.tw/index.php?k=${category}`;
} else {
url = `https://acg.gamer.com.tw/news.php?p=${category}`;
}
}
@ -41,17 +42,17 @@ module.exports = async (ctx) => {
method: 'get',
url: url,
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('div.BH-lbox.GN-lbox2')
.children()
.not('.GN-lbox2A,.GN-lbox2G')
.map((index, item) => {
item = $(item);
const position = item.attr('class') === 'GN-lbox2F' ? 0 : 1;
const element_a = item.find('a').eq(position);
const tag_table = {
const ElementA = item.find('a').eq(position);
const tagTable = {
'IMG-Gmuti': 'General',
'IMG-GA19': 'PC',
'IMG-GB3': 'NS',
@ -69,30 +70,44 @@ module.exports = async (ctx) => {
'IMG-GA17': 'Other',
'IMG-Gother': 'Other',
};
const key = item.find('img').eq(position).attr('class');
const value = tag_table[key];
const tag = value ? value : 'Unclassified';
const tagValue = tagTable[item.find('img').eq(position).attr('class')];
const tag = tagValue ? tagValue : 'Unclassified';
return {
title: '[' + tag + ']&nbsp;' + element_a.text(),
link: element_a.attr('href').replace('//', 'https://'),
title: '[' + tag + ']&nbsp;' + ElementA.text(),
link: ElementA.attr('href').replace('//', 'https://'),
};
})
.get();
const items = await Promise.all(
list.map(async (item) => {
// 图片延迟加载无法获取源地址;
let author = '';
item.description = await ctx.cache.tryGet(item.link, async () => {
const response = await got.get(item.link);
const $ = cheerio.load(response.data);
return $('div.GN-lbox3B').children('div').html();
let component = '';
const urlReg = /window.location.replace\('.*'/g;
if (response.body.search(urlReg) < 0) {
const $ = cheerio.load(response.data);
component = $('div.GN-lbox3B').html();
author = $('span.GN-lbox3C').text().split('')[0].split(' 報導')[0].split(' 提供')[0].split(' 同意授權轉載')[0].replace('', '');
} else {
const newUrl = response.body.match(urlReg)[0].split('(')[1].replace("'", '');
const _response = await got.get(newUrl);
const _$ = cheerio.load(_response.data);
component = _$('div.MSG-list8C').html();
item.link = newUrl;
author = _$('span.ST1').text().split('│', 2)[0].split('作者:')[1];
}
component = component.replace(/\b(data-src)\b/g, 'src');
return component;
});
item.author = author;
return item;
})
);
ctx.state.data = {
title: '巴哈姆特-GNN新闻-' + category_name,
title: '巴哈姆特-GNN新聞' + categoryName,
link: url,
item: items,
};

49
lib/routes/gamer/hot.js Normal file
View File

@ -0,0 +1,49 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = `https://forum.gamer.com.tw/A.php?bsn=${ctx.params.bsn}`;
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const list = $('div.FM-abox2A a.FM-abox2B')
.slice(0, 10)
.map((_, item) => {
item = $(item);
return {
link: `https:${item.attr('href')}`,
};
})
.get();
const items = await Promise.all(
list.map(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
content('div.c-post__body__buttonbar').remove();
item.title = content('.c-post__header__title').text();
item.description = content('div.c-post__body').html();
item.author = `${content('a.username').eq(0).text()} (${content('a.userid').eq(0).text()})`;
item.pubDate = new Date(content('a.edittime').eq(0).attr('data-mtime') + ' GMT+8').toUTCString();
return item;
})
)
);
ctx.state.data = {
title: $('title').text(),
link: rootUrl,
item: items,
};
};

View File

@ -0,0 +1,62 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
ctx.params.order = ctx.params.order || '';
ctx.params.keyword = ctx.params.keyword || '';
ctx.params.caty = ctx.params.caty || '';
const rootUrl = `http://xinsheng.huawei.com/cn/index.php?app=forum&mod=List&class=461&order=${ctx.params.order}&search=${ctx.params.keyword}&cate=${ctx.params.caty}`;
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
$('a[linktag="__subject_link__"]').remove();
const list = $('.bbs_list ul li .font_box .title p font a')
.slice(0, 15)
.map((_, item) => {
item = $(item);
return {
title: item.attr('title'),
link: item.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const content = cheerio.load(detailResponse.data);
item.description = content('.bbs_info_right_text').eq(0).html();
item.pubDate = new Date(content('span.fl').eq(0).text().trim() + ' GMT+8').toUTCString();
item.author = content('.bbs_info_user_ a').eq(1).text();
return item;
})
)
);
let title;
$('.bbs_list_box_title_wz ul li').each(function () {
if ($(this).hasClass('on')) {
title = $(this).text();
return;
}
});
ctx.state.data = {
title: `${title} - 华为家事 - 心声社区`,
link: rootUrl,
item: items,
};
};

30
lib/routes/icity/index.js Normal file
View File

@ -0,0 +1,30 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = `https://icity.ly/u/${ctx.params.id}`;
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const items = $('li.diary')
.map((_, item) => {
item = $(item);
return {
link: rootUrl,
title: item.prev('li.day-cut').text(),
description: item.find('div.line').html(),
pubDate: new Date(item.find('time.hours').attr('datetime')).toUTCString(),
};
})
.get();
ctx.state.data = {
title: $('title').text(),
link: rootUrl,
item: items,
description: $('div.bio').text(),
};
};

View File

@ -88,7 +88,7 @@ module.exports = async (ctx) => {
return list.map((item) => ({
title: `${typeName}` + item.sTitle,
link: getUrl(item.sRedirectURL, item.iDocID, item.sVID),
pubDate: new Date(`${item.sCreated} GMT`).toUTCString(),
pubDate: new Date(`${item.sCreated} UTC+8`).toUTCString(),
guid: item.iDocID,
}));
}

23
lib/routes/ow/patch.js Normal file
View File

@ -0,0 +1,23 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const rootUrl = 'https://ow.blizzard.cn';
const currentUrl = `${rootUrl}/action/article/patch?p=1&pageSize=10`;
const response = await got({
method: 'get',
url: currentUrl,
});
const items = response.data.data.list.map((item) => ({
title: item.description,
link: `${rootUrl}/article/news/${item.articleId}`,
description: item.content,
pubDate: new Date(item.publishTime).toUTCString(),
}));
ctx.state.data = {
title: '《守望先锋》补丁说明',
link: `${rootUrl}/game/patch-notes`,
item: items,
};
};

View File

@ -0,0 +1,95 @@
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(
async (item) =>
await 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(
async (link) =>
await 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,
};
};

View File

@ -4,7 +4,7 @@ const cheerio = require('cheerio');
module.exports = async (ctx) => {
const cookie = config.btbyr.cookies;
const url = config.btbyr.host;
const url = config.btbyr.host || 'https://bt.byr.cn/';
const response = await got({
method: 'get',
url: url + `log.php?action=funbox`,
@ -24,6 +24,7 @@ module.exports = async (ctx) => {
.find('tr > td.rowfollow')
.eq(2)
.html()
.replace(/https:\/\/bt.byr.cn\//g, url)
.replace(/onclick=.*findPosition\(this\)\[1\]-58\);"/g, '')
.replace(/.thumb.jpg/g, ''),
link: url + `log.php?action=funbox`,

View File

@ -2,8 +2,8 @@ const got = require('@/utils/got');
const cheerio = require('cheerio');
const resolve_url = require('url').resolve;
const base_url = 'https://thu.pka.moe';
const news_url = 'https://thu.pka.moe/http/77726476706e69737468656265737421e0f852882e3e6e5f301c9aa596522b2043f84ba24ebecaf8/f/';
const base_url = 'http://info.tsinghua.edu.cn/';
const news_url = 'http://postinfo.tsinghua.edu.cn/f/';
module.exports = async (ctx) => {
const type = ctx.params.type;

View File

@ -23,7 +23,7 @@ module.exports = async (ctx) => {
const title = $el.find('a').last().text();
const imgEL = $el.find('a').first();
const link = imgEL.attr('href');
const imgSrc = imgEL.find('.img_book').attr('src');
const imgSrc = `${imgEL.find('.img_book').attr('style')}`.replace(/.*\s?url\(['"]?/, '').replace(/['"]?\).*/, '');
const match = $el.text().match(/\[[\s\S]*?\]/g);
const detail = $el.find('.pagefoot').text();
const date = $el.find('.filesize').text();

View File

@ -0,0 +1,37 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
ctx.params.year = ctx.params.year || new Date().getFullYear();
const rootUrl = 'https://www.wto.org';
const currentUrl = `${rootUrl}/library/news/news_${ctx.params.year}_e.js`;
const response = await got({
method: 'get',
url: currentUrl,
});
const data = response.data.split('] = {');
data.shift();
const items = data.map((item) => {
item = '{' + item.split('news_item[')[0].replace('};', '}');
return {
title: item.match(/ni_head:"(.*)",/)[1],
link: item.match(/nl_url:"(.*)",/)[1],
description: item.match(/ni_intro:"(.*)",/)[1],
pubDate: new Date(
item
.match(/ni_date:"(.*)",/)[1]
.replace(/\./g, '-')
.replace('_', ' ')
).toUTCString(),
};
});
ctx.state.data = {
title: `Dispute settlement news archive ${ctx.params.year} - WTO`,
link: currentUrl,
item: items,
};
};

View File

@ -32,8 +32,30 @@ module.exports = async (ctx) => {
const $ = cheerio.load(response.data);
return $('div.p-main-contents').html();
});
let tag = '';
if (category_name === '総合') {
const tag_table = {
news: '総合',
national: '社会',
politics: '政治',
economy: '経済',
sports: 'スポーツ',
world: '国際',
science: '科学・IT',
election: '選挙・世論調査',
culture: 'エンタメ・文化',
igoshougi: '囲碁・将棋',
life: 'ライフ',
local: '地域',
editorial: '社説',
medical: '医療・健康',
};
const tag_value = tag_table[link.split('/')[3]];
tag = tag_value ? tag_value : 'その他';
tag = '[' + tag + '] ';
}
return {
title: item.find('a').text(),
title: tag + item.find('a').text(),
description,
link,
};

View File

@ -0,0 +1,70 @@
const got = require('@/utils/got');
const config = {
latest: {
zh_CN: '10',
zh_TW: '87',
},
news: {
zh_CN: '11',
zh_TW: '90',
},
notice: {
zh_CN: '12',
zh_TW: '91',
},
activity: {
zh_CN: '258',
zh_TW: '92',
},
};
const titles = {
latest: {
zh_CN: '最新',
zh_TW: '最新',
},
news: {
zh_CN: '新闻',
zh_TW: '資訊',
},
notice: {
zh_CN: '公告',
zh_TW: '公告',
},
activity: {
zh_CN: '活动',
zh_TW: '活動',
},
};
module.exports = async (ctx) => {
ctx.params.location = ctx.params.location || 'zh_CN';
ctx.params.category = ctx.params.category || 'latest';
let rootUrl;
if (ctx.params.location === 'zh_CN') {
rootUrl = `https://ys.mihoyo.com/content/ysCn/getContentList?pageSize=5&pageNum=1&channelId=${config[ctx.params.category][ctx.params.location]}`;
} else {
rootUrl = `https://genshin.mihoyo.com/content/yuanshen/getContentList?pageSize=5&pageNum=1&channelId=${config[ctx.params.category][ctx.params.location]}`;
}
const response = await got({
method: 'get',
url: rootUrl,
});
const list = response.data.data.list.map((item) => ({
title: item.title,
link: `https://ys.mihoyo.com/main/news/detail/${item.id}`,
pubDate: new Date(item.start_time + ' GMT+8').toUTCString(),
author: item.author,
}));
ctx.state.data = {
title: `${titles[ctx.params.category][ctx.params.location]} - 原神`,
link: rootUrl,
item: list,
};
};

View File

@ -1,68 +1,62 @@
const got = require('@/utils/got');
const utils = require('./utils');
const crypto = require('crypto');
const jsencrypt = require('./execlib/jsencrypt');
module.exports = async (ctx) => {
const id = ctx.params.id;
const d_c0 = await getDC0FromCookies(id);
const zst81 =
'3_2.0ae3TnRUTEvOOUCNMTQnTSHUZo02p-HNMZBO8YD_q2Xtuo_Y0K6P0E6uy-LS9-hp1DufI-we8gGHPgJO1xuPZ0GxCTJHR7820XM20cLRGDJXfgGCBxupMuD_Ic4cpr4w0mRPO7HoY70SfquPmz93mhDQyiqV9ebO1hwOYiiR0ELYuUrxmtDomqU7ynXtOnAoTh_PhRDSTF82VVh29ZhFL1bUYbLgszUc04wFMCrLf9ucOA9HYMGVmzDwyJG2_tJSC4CeTveg11UY9qcX0DhoY2eS1u9efxCVqxGYMhrxyqh2pwucY8bSBwge0Vbx8fBtYWuVMcqumUqSBchLCzJLOErpL3hepEgHfyuYBZrx9oBo1o7NY7CL_fh90Vqkwq9COGMVYzc9BnugLJCw9-GXmShgO0h3KHU2YsQx0zqxY8DNmuUwOMwt1oMOOQvN_iBg8ZqVBtbo_rDwVQvw1JUNmZcN_wBSBAD3KwqN83rO0QTLsWwYC';
const zse83 = '3_2.0';
const path = `/api/v4/members/${id}/answers?include=data%5B*%5D.is_normal%2Cadmin_closed_comment%2Creward_info%2Cis_collapsed%2Cannotation_action%2Cannotation_detail%2Ccollapse_reason%2Ccollapsed_by%2Csuggest_edit%2Ccomment_count%2Ccan_comment%2Ccontent%2Ceditable_content%2Cvoteup_count%2Creshipment_settings%2Ccomment_permission%2Cmark_infos%2Ccreated_time%2Cupdated_time%2Creview_info%2Cexcerpt%2Cis_labeled%2Clabel_info%2Crelationship.is_authorized%2Cvoting%2Cis_author%2Cis_thanked%2Cis_nothelp%2Cis_recognized%3Bdata%5B*%5D.author.badge%5B%3F(type%3Dbest_answerer)%5D.topics%3Bdata%5B*%5D.question.has_publishing_draft%2Crelationship&offset=0&limit=20&sort_by=created`;
const currenURI = `https://www.zhihu.com/people/${id}/answers`;
const tmp = [zse83, path, currenURI, d_c0, zst81].join('+');
const md5 = crypto.createHash('md5');
const signature = jsencrypt(md5.update(tmp).digest('hex'));
const xzseHeaders = {
'x-zse-83': zse83,
'x-zse-86': '1.0_' + signature,
'x-zst-81': zst81,
const headers = {
'User-Agent': 'ZhihuHybrid com.zhihu.android/Futureve/6.59.0 Mozilla/5.0 (Linux; Android 10; GM1900 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/85.0.4183.127 Mobile Safari/537.36',
Referer: `https://www.zhihu.com/people/${id}/answers`,
};
const response = await got({
method: 'get',
url: `https://www.zhihu.com${path}`,
headers: {
...utils.header,
...xzseHeaders,
Referer: `https://www.zhihu.com/people/${id}/answers`,
cookie: `d_c0=${d_c0}`,
},
url: `https://api.zhihu.com/people/${id}/answers?order_by=created&offset=0&limit=10`,
headers: headers,
});
const data = response.data.data;
let name = data[0].author.name;
if (name === '知乎用户') {
const info = await got({
method: 'get',
url: `https://www.zhihu.com/api/v4/members/${id}/activities?limit=1`,
headers: {
...utils.header,
Referer: `https://www.zhihu.com/people/${id}/activities`,
Authorization: 'oauth c3cef7c66a1843f8b3a9e6a1e3160e20', // hard-coded in js
},
});
name = info.data.data[0].actor.name;
}
const items = await Promise.all(
data.map(async (item) => {
let description;
const link = `https://www.zhihu.com/question/${item.question.id}/answer/${item.id}`;
const title = item.question.title;
try {
const detail = await got({
method: 'get',
url: `https://api.zhihu.com/appview/api/v4/answers/${item.id}?include=content&is_appview=true`,
headers: headers,
});
description = utils.ProcessImage(detail.data.content);
} catch (e) {
description = `<a href="${link}" target="_blank">${title}</a>`;
}
return {
title: title,
description: description,
pubDate: new Date(item.created_time * 1000).toUTCString(),
link: link,
};
})
);
ctx.state.data = {
title: `${data[0].author.name}的知乎回答`,
title: `${name}的知乎回答`,
link: `https://www.zhihu.com/people/${id}/answers`,
description: data[0].author.headline || data[0].author.description,
item: data.map((item) => ({
title: item.question.title,
description: utils.ProcessImage(item.content),
pubDate: new Date(item.created_time * 1000).toUTCString(),
link: `https://www.zhihu.com/question/${item.question.id}/answer/${item.id}`,
})),
item: items,
};
};
async function getDC0FromCookies(id) {
const url = `https://www.zhihu.com/people/${id}`;
const response = await got({
method: 'get',
url,
headers: {
...utils.header,
},
});
const targetCookies = (response.headers['set-cookie'] || []).filter((c) => /d_c0=([^;]+)/.test(c));
const matchResult = (targetCookies[0] || '').match(new RegExp('d_c0=([^;]+)'));
return matchResult[1] || '';
}

View File

@ -8,11 +8,11 @@ module.exports = async (ctx) => {
data: { data },
} = await got({
method: 'get',
url: `https://www.zhihu.com/api/v4/members/${id}/pins?offset=0&limit=20&includes=data%5B*%5D.upvoted_followees%2Cadmin_closed_comment`,
url: `https://api.zhihu.com/pins/${id}/moments?limit=10&offset=0`,
});
ctx.state.data = {
title: `${data[0].author.name}的知乎想法`,
title: `${data[0].target.author.name}的知乎想法`,
link: `https://www.zhihu.com/people/${id}/pins`,
item: generateData(data),
};

View File

@ -0,0 +1,18 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
ctx.params.cateid = ctx.params.cateid || '35';
const response = await got.get(`http://www.zsnews.cn/api/mobile/getlist.html?cateid=${ctx.params.cateid}`);
ctx.state.data = {
title: '中山新闻',
link: 'https://www.zsnews.cn/',
item: response.data.map((item) => ({
guid: item.id,
title: item.title,
description: item.title,
link: item.url,
})),
};
};

View File

@ -42,7 +42,7 @@
"@vuepress/plugin-pwa": "1.6.0",
"cross-env": "7.0.2",
"entities": "2.0.3",
"eslint": "7.10.0",
"eslint": "7.11.0",
"eslint-config-prettier": "6.12.0",
"eslint-plugin-prettier": "3.1.4",
"jest": "26.5.2",
@ -104,7 +104,7 @@
"pidusage": "2.0.21",
"plist": "3.0.1",
"puppeteer": "5.3.1",
"query-string": "6.13.4",
"query-string": "6.13.5",
"redis": "3.0.2",
"require-all": "3.0.0",
"rss-parser": "3.9.0",

View File

@ -4913,10 +4913,15 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e"
integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
eslint@7.10.0:
version "7.10.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.10.0.tgz#494edb3e4750fb791133ca379e786a8f648c72b9"
integrity sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==
eslint-visitor-keys@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8"
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
eslint@7.11.0:
version "7.11.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.11.0.tgz#aaf2d23a0b5f1d652a08edacea0c19f7fadc0b3b"
integrity sha512-G9+qtYVCHaDi1ZuWzBsOWo2wSwd70TXnU6UHA3cTYHp7gCTXZcpggWFoUVAMRarg68qtPoNfFbzPh+VdOgmwmw==
dependencies:
"@babel/code-frame" "^7.0.0"
"@eslint/eslintrc" "^0.1.3"
@ -4928,7 +4933,7 @@ eslint@7.10.0:
enquirer "^2.3.5"
eslint-scope "^5.1.1"
eslint-utils "^2.1.0"
eslint-visitor-keys "^1.3.0"
eslint-visitor-keys "^2.0.0"
espree "^7.3.0"
esquery "^1.2.0"
esutils "^2.0.2"
@ -10157,10 +10162,10 @@ qs@~6.5.2:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
query-string@6.13.4, query-string@^6.2.0:
version "6.13.4"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.4.tgz#b35a9a3bd4955bce55f94feb0e819b3d0be6f66f"
integrity sha512-E2NPIeJoBEJGQNy3ib1k/Z/OkDBUKIo8IV2ZVwbKfoa65IS9unqWWUlLcbfU70Da0qNoxUZZA8CfKUjKLE641Q==
query-string@6.13.5, query-string@^6.2.0:
version "6.13.5"
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.5.tgz#99e95e2fb7021db90a6f373f990c0c814b3812d8"
integrity sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==
dependencies:
decode-uri-component "^0.2.0"
split-on-first "^1.0.0"