Merge branch 'master' into eventernote

This commit is contained in:
KTachibanaM
2020-10-06 23:29:00 -07:00
18 changed files with 799 additions and 425 deletions
+6
View File
@@ -701,6 +701,12 @@ area 分区选项
</Route>
## 高科技行业门户
### 新闻
<Route author="luyuhuang" example="/ofweek/news" path="/ofweek/news"/>
## 谷歌新闻
### 新闻
+19
View File
@@ -800,6 +800,25 @@ type 为 all 时,category 参数不支持 cost 和 free
<Route author="SunShinenny" example="/zhilian/台州/JavaScript" path="/zhilian/:city/:keyword" :paramsDesc="['城市「如若无该城市数据,将会报错」','搜索关键词']"/>
## 中国工程科技知识中心
### 知识应用
<Route author="nczitzk" example="/cktest/app" path="/cktest/app/:ctgroup?/:domain?" :paramsDesc="['所属类别,见下表,默认为全部类别', '领域,见下表,默认为全部列表']">
所属类别
| 专题知识服务 | 知识分析 | 知识工具 | 综合性知识服务 | 全部类别 |
| ------------ | -------- | -------- | -------------- | -------- |
| 2 | 3 | 4 | 1 | 0 |
领域
| 综合 | 农业 | 航天 | 地质 | 信息技术 | 林业 | 医药卫生 | 战略性新兴产业 | 能源 | 冶金 | 化工 | 地理信息 | 营养健康 | 工程科教图书 | 交通 | 创新设计 | 地理资源与生态 | 材料 | 气象 | 渔业 | 环境工程 | 试验技术 | 中草药 | 水利 | 海洋工程 |
| ---- | ---- | ---- | ---- | -------- | ---- | -------- | -------------- | ---- | ---- | ---- | -------- | -------- | ------------ | ---- | -------- | -------------- | ---- | ---- | ---- | -------- | -------- | ------ | ---- | -------- |
</Route>
## 中国银行
### 中国银行外汇牌价
+25
View File
@@ -117,6 +117,31 @@ pageClass: routes
<Route author="hoilc" example="/loveheaven/update/kimetsu-no-yaiba" path="/loveheaven/update/:slug" :paramsDesc="['漫画 slug,可在漫画页面URL中找到,不包括开头的`manga-`,也不包括末尾的`.html`']" />
## MM 范
### 分类
<Route author="nczitzk" example="/95mm/tab/热门" path="/95mm/tab/:tab?" :paramsDesc="['分类,见下表,默认为最新']">
| 最新 | 热门 | 校花 | 森系 | 清纯 | 童颜 | 嫩模 | 少女 |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
</Route>
### 标签
<Route author="nczitzk" example="/95mm/tag/黑丝" path="/95mm/tag/:tag" :paramsDesc="['标签,可在对应标签页中找到']"/>
### 集合
<Route author="nczitzk" example="/95mm/category/1" path="/95mm/category/:category" :paramsDesc="['集合,见下表']">
| 清纯唯美 | 摄影私房 | 明星写真 | 三次元 | 异域美景 | 性感妖姬 | 游戏主题 | 美女壁纸 |
| -------- | -------- | -------- | ------ | -------- | -------- | -------- | -------- |
| 1 | 2 | 4 | 5 | 6 | 7 | 9 | 11 |
</Route>
## NASA 每日天文图片
### NASA
+15
View File
@@ -279,6 +279,21 @@ Type 栏目:
<Route author="AgFlore" example="/theinitium/tags/2019_10/zh-hans" path="/theinitium/tags/:type/:language?" :paramsDesc="['话题ID,可从话题页URL中获取,如<https://theinitium.com/tags/2019_10/>', '语言,简体`zh-hans`,繁体`zh-hant`,缺省为简体']"/>
### 作者
<Route author="AgFlore" example="/theinitium/author/ninghuilulu/zh-hans" path="theinitium/author/:type/:language?" :paramsDesc="['作者ID,可从作者主页URL中获取,如<https://theinitium.com/author/ninghuilulu/>','语言,简体`zh-hans`,繁体`zh-hant`,缺省为简体']"/>
### 个人订阅追踪动态
<Route author="AgFlore" example="/theinitium/follow/articles/zh-hans" path="theinitium/follow/articles/:language?" :paramsDesc="['语言,简体`zh-hans`,繁体`zh-hant`,缺省为简体']">
::: warning 注意
需要自建,详情见部署页面的配置模块。
:::
</Route>
## 多维新闻网
### 要闻
+14
View File
@@ -1924,6 +1924,16 @@ type 列表:
## 中国科学院
### 成果转化
<Route author="nczitzk" example="/cas/cg/cgzhld" path="/cas/cg/:caty?" :paramsDesc="['分类,见下表,默认为工作动态']">
| 工作动态 | 科技成果转移转化亮点工作 |
| -------- | ------------------------ |
| zh | cgzhld |
</Route>
### 上海微系统与信息技术研究所学术活动
<Route author="HenryQW" example="/cas/sim/academic" path="/cas/sim/academic"/>
@@ -1932,6 +1942,10 @@ type 列表:
<Route author="renzhexigua" example="/cas/mesalab/kb" path="/cas/mesalab/kb"/>
### 中国科学院电工研究所 科研动态
<Route author="nczitzk" example="/cas/iee/kydt" path="/cas/iee/kydt"/>
## 中国农业大学
### 中国农业大学研招网通知公告
+13
View File
@@ -666,6 +666,8 @@ router.get('/gdut/news', require('./routes/universities/gdut/news'));
// 中国科学院
router.get('/cas/sim/academic', require('./routes/universities/cas/sim/academic'));
router.get('/cas/mesalab/kb', require('./routes/universities/cas/mesalab/kb'));
router.get('/cas/iee/kydt', require('./routes/universities/cas/iee/kydt'));
router.get('/cas/cg/:caty?', require('./routes/universities/cas/cg/index'));
// 中国传媒大学
router.get('/cuc/yz', require('./routes/universities/cuc/yz'));
@@ -3255,6 +3257,14 @@ router.get('/appsales/:caty?/:time?', require('./routes/appsales/index'));
// CGTN
router.get('/cgtn/top', require('./routes/cgtn/top'));
// MM范
router.get('/95mm/tab/:tab?', require('./routes/95mm/tab'));
router.get('/95mm/tag/:tag', require('./routes/95mm/tag'));
router.get('/95mm/category/:category', require('./routes/95mm/category'));
// 中国工程科技知识中心
router.get('/cktest/app/:ctgroup?/:domain?', require('./routes/cktest/app'));
// 妈咪帮
router.get('/mamibuy/:caty?/:age?/:sort?', require('./routes/mamibuy/index'));
@@ -3292,6 +3302,9 @@ router.get('/gamer/gnn/:category?', require('./routes/gamer/gnn_index'));
// 中国人大网
router.get('/npc/:caty', require('./routes/npc/index'));
// 高科技行业门户
router.get('/ofweek/news', require('./routes/ofweek/news'));
// eventernote
router.get('/eventernote/actors/:name/:id', require('./routes/eventernote/actors'));
+18
View File
@@ -0,0 +1,18 @@
const utils = require('./utils');
module.exports = async (ctx) => {
const categories = {
1: '清纯唯美',
2: '摄影私房',
4: '明星写真',
5: '三次元',
6: '异域美景',
7: '性感妖姬',
9: '游戏主题',
11: '美女壁纸',
};
const rootUrl = `https://www.95mm.net/category-${ctx.params.category}/list-1/index.html?page=1`;
ctx.state.data = await utils(ctx, categories[ctx.params.category], rootUrl);
};
+9
View File
@@ -0,0 +1,9 @@
const utils = require('./utils');
module.exports = async (ctx) => {
ctx.params.tab = ctx.params.tab || '最新';
const rootUrl = `https://www.95mm.net/home-ajax/index.html?tabcid=${ctx.params.tab}&page=1`;
ctx.state.data = await utils(ctx, ctx.params.tab, rootUrl);
};
+7
View File
@@ -0,0 +1,7 @@
const utils = require('./utils');
module.exports = async (ctx) => {
const rootUrl = `https://www.95mm.net/tag-${ctx.params.tag}/page-1/index.html`;
ctx.state.data = await utils(ctx, ctx.params.tag, rootUrl);
};
+52
View File
@@ -0,0 +1,52 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx, title, rootUrl) => {
const response = await got({
method: 'get',
url: rootUrl,
header: {
Referer: 'https://www.95mm.net',
},
});
const $ = cheerio.load(response.data);
const list = $('div.list-body')
.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(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const detailResponse = await got({
method: 'get',
url: item.link,
});
const images = detailResponse.data.match(/src": '(.*?)',"width/g);
item.description = '';
for (const i of images) {
item.description += `<img src="${i.split("'")[1]}">`;
}
return item;
})
)
);
return {
title: `${title} - MM范`,
link: rootUrl,
item: items,
};
};
+34
View File
@@ -0,0 +1,34 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const ctgroup = ctx.params.ctgroup ? (ctx.params.ctgroup === '0' ? '' : 'CTGRGUP==' + ctx.params.ctgroup) : '';
const domain = ctx.params.domain ? 'DOMAIN==' + ctx.params.domain : '';
const rootUrl = `http://www.ckcest.cn/home/app/list?category=${ctgroup}${ctgroup && domain ? ' AND ' : ''}${domain}`;
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const items = $('.search-result-list')
.map((_, item) => {
item = $(item);
const a = item.find('h4.sc-title a');
return {
title: a.text(),
link: a.attr('href'),
description: item.find('.applySummary-new').text(),
author: item.find('.applyInfor-new span').eq(1).text(),
pubDate: new Date(item.find('.applyInfor-new span').eq(0).text() + ' GMT+8').toUTCString(),
};
})
.get();
ctx.state.data = {
title: '知识应用 - 中国工程科技知识中心',
link: rootUrl,
item: items,
};
};
+1 -1
View File
@@ -14,7 +14,7 @@ module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: `http://api.act.sdo.com/UnionNews/List?gameCode=ma&category=${type_number[type]}&pageIndex=0&pageSize=50`,
url: `http://api.act.sdo.com/UnionNews/List?gameCode=ff&category=${type_number[type]}&pageIndex=0&pageSize=50`,
headers: {
Referer: referer,
},
+22 -9
View File
@@ -4,23 +4,21 @@ const cheerio = require('cheerio');
const resolve_url = require('url').resolve;
module.exports = async (ctx) => {
// model是channel/tag/etc.,而type是latest/feature/quest-academy/etc.
// model是channel/tag/etc.,而type是latest/feature/quest-academy这些一级栏目/标签/作者名的slug名。如果是追踪的话,那就是model是follow,type是articles。
const model = ctx.params.model || 'channel';
const type = ctx.params.type || 'latest';
const language = ctx.params.language || 'zh-hans';
let listurl;
let listlink;
switch (model) {
/*
case 'author':
listurl = `https://api.theinitium.com/api/v2/author/?language=${language}&slug=${type}`;
listlink = `https://theinitium.com/author/${type}/`;
break;
case 'follows':
listurl = `https://api.theinitium.com/api/v2/user/follows/?language=${language}&slug=${type}`;
case 'follow':
listurl = `https://api.theinitium.com/api/v2/user/follows/${type}/?language=${language}`;
listlink = `https://theinitium.com/follow/`;
break;
*/
case 'channel':
listurl = `https://api.theinitium.com/api/v2/channel/articles/?language=${language}&slug=${type}`;
listlink = `https://theinitium.com/channel/${type}/`;
@@ -90,9 +88,11 @@ module.exports = async (ctx) => {
},
});
const name = response.data.name;
const articles = response.data.digests;
const image = 'https://d32kak7w9u5ewj.cloudfront.net/static/bundles/0b9cf7fe9c518887768e6c485764cd12.ico';
const name = response.data.name || (response.data[model] && response.data[model].name) || '追踪';
// 从v1直升的channel和tags里面是digests,v2新增的author和follow出来都是results
const articles = response.data.results ? response.data.results : response.data.digests;
// 如果model=author,那就是avatar;否则都是cover,要么就没封面
const image = response.data[model] && (response.data[model].cover || response.data[model].avatar);
const getFullText = async (slug) => {
let content = await ctx.cache.get(slug + language);
@@ -125,6 +125,18 @@ module.exports = async (ctx) => {
}
if (data.content) {
content += data.content.replace('<figure class="advertisement"/><br/>', '').replace(/<br><br>-----------<br>.*$/g, '');
} else if (data.type === 'html') {
// 有时候编辑部会漏录入文章信息…………扶额。所以加这一个判断,如果确实是普通html文章,但又没有内容,说明是漏了,后面还要给guid手动加个标记,以便阅读器事后重抓。
content += '内容为空,请稍后再来';
} else if (data.type === 'web') {
// 有时候文章并非普通html文章,而是带有互动内容等,表现为type为web,并且content里没有内容。我们也尽力抓点东西下来。
// 或许可能还有其他未知情况,等碰到了再说吧。先这样留空也不碍事。
const nonhtmlcontent = await got({
method: 'get',
url: data.web.url,
});
const webcontent = cheerio.load(nonhtmlcontent.body).html();
content += webcontent;
}
if (data.paywall_enabled) {
const google_bot_ua =
@@ -159,7 +171,8 @@ module.exports = async (ctx) => {
link: resolve_url('https://theinitium.com', item.article.url),
pubDate: item.article.date,
updated: item.article.updated,
guid: item.article.uuid,
// 如果遇到编辑部漏录入情况,则给uuid做个手脚,以便阅读器到时重抓。
guid: (await getFullText(item.article.slug)).endsWith('内容为空,请稍后再来') ? item.article.uuid + '-I-am-empty' : item.article.uuid,
}))
);
+45
View File
@@ -0,0 +1,45 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const iconv = require('iconv-lite');
module.exports = async (ctx) => {
const response = await got({
method: 'get',
url: 'https://www.ofweek.com/CATList-8100-CHANGYIEXINWE.html',
responseType: 'buffer',
});
const $ = cheerio.load(iconv.decode(response.data, 'gbk'));
const list = $('div.list-left div.con-details h3 > a')
.slice(0, 20)
.map((_, item) => {
item = $(item);
return {
title: item.text(),
link: item.attr('href'),
};
})
.get();
const items = await Promise.all(
list.map(
async (item) =>
await ctx.cache.tryGet(item.link, async () => {
const res = await got({ method: 'get', url: item.link, responseType: 'buffer' });
const content = cheerio.load(iconv.decode(res.data, 'gbk'));
const artical = content('div.artical');
item.description = artical.find('#articleC').html();
item.author = artical.find('div.source-name').text();
item.pubDate = artical.find('div.time.fl').text();
item.pubDate = new Date(item.pubDate + ' GMT+8').toUTCString();
return item;
})
)
);
ctx.state.data = {
title: '高科技行业门户',
link: 'https://www.ofweek.com/CATList-8100-CHANGYIEXINWE.html',
item: items,
};
};
+51
View File
@@ -0,0 +1,51 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
ctx.params.caty = ctx.params.caty || 'zh';
const rootUrl = 'https://www.cas.cn';
const currentUrl = `${rootUrl}/cg/${ctx.params.caty}`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = cheerio.load(response.data);
const list = $('#content li')
.not('.gl_line')
.slice(0, 15)
.map((_, item) => {
item = $(item);
const a = item.find('a');
return {
title: a.text(),
link: `${rootUrl}/cg/${ctx.params.caty}${a.attr('href').replace('.', '')}`,
};
})
.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('.TRS_Editor').html();
item.pubDate = new Date(content('meta[name="PubDate"]').attr('content') + ' GMT+8').toUTCString();
return item;
})
)
);
ctx.state.data = {
title: $('title').text().replace('----', ' - '),
link: currentUrl,
item: items,
};
};
+47
View File
@@ -0,0 +1,47 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const rootUrl = 'http://www.iee.cas.cn/xwzx/kydt';
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const list = $('li.entry .entry-content-title')
.slice(0, 15)
.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(
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('.article-content').html();
item.pubDate = new Date(content('time').text().split(':')[1] + ' GMT+8').toUTCString();
return item;
})
)
);
ctx.state.data = {
title: '科研成果 - 中国科学院电工研究所',
link: rootUrl,
item: items,
};
};
+3 -3
View File
@@ -45,7 +45,7 @@
"eslint": "7.10.0",
"eslint-config-prettier": "6.12.0",
"eslint-plugin-prettier": "3.1.4",
"jest": "26.4.2",
"jest": "26.5.2",
"mockdate": "3.0.2",
"nock": "13.0.4",
"nodemon": "2.0.4",
@@ -66,7 +66,7 @@
"dependencies": {
"@koa/router": "9.4.0",
"@postlight/mercury-parser": "2.2.0",
"@sentry/node": "5.24.2",
"@sentry/node": "5.25.0",
"aes-js": "3.1.2",
"art-template": "4.13.2",
"cheerio": "1.0.0-rc.3",
@@ -80,7 +80,7 @@
"etag": "1.8.1",
"fanfou-sdk": "4.2.0",
"git-rev-sync": "3.0.1",
"googleapis": "60.0.1",
"googleapis": "61.0.0",
"got": "11.7.0",
"he": "1.2.0",
"hooman": "1.2.6",
+418 -412
View File
File diff suppressed because it is too large Load Diff