Merge remote-tracking branch 'DIYgod/master' into dev

This commit is contained in:
Henry
2019-01-28 20:17:00 +00:00
12 changed files with 949 additions and 734 deletions
+14 -4
View File
@@ -391,6 +391,8 @@ RSSHub 提供下列 API 接口:
<route name="公众号(瓦斯来源)" author="DIYgod" example="/wechat/wasi/5b575db858e5c4583338db11" path="/wechat/wasi/:id" :paramsDesc="['瓦斯公众号 id, 可在[瓦斯](https://w.qnmlgb.tech/wx)搜索公众号, 打开公众号页, 在 URL 中找到 id']"/>
<route name="公众号( wemp.app 来源)" author="HenryQW" example="/wechat/wemp/36836fbe-bdec-4758-8967-7cc82722952d" path="/wechat/wemp/:id" :paramsDesc="['wemp 公众号 id, 可在搜索引擎使用 `site:wemp.app` 搜索公众号(例如: 人民日报 site:wemp.app), 打开公众号页, 在 URL 中找到 id']"/>
<route name="公众平台系统公告栏目" author="xyqfer" example="/wechat/announce" path="/wechat/announce" />
<route name="小程序插件" author="xyqfer" example="/wechat/miniprogram/plugins" path="/wechat/miniprogram/plugins" />
@@ -946,6 +948,10 @@ GitHub 官方也提供了一些 RSS:
<route name="新片精品" author="imgss" example="/dytt" path="/dytt"/>
### rs05 人生 05 电影
<route name="rs05电影列表" author="monner-henster" example="/rs05/rs05" path="/rs05/rs05"/>
### 优酷
<route name="频道" author="xyqfer" example="/youku/channel/UNTg3MTM3OTcy" path="/youku/channel/:channelId/:embed?" :paramsDesc="['频道 id', '默认为开启内嵌视频, 任意值为关闭']"/>
@@ -2808,10 +2814,6 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
<route name="最新" author="xyqfer" example="/icourse163/newest" path="/icourse163/newest" />
### 好奇心日报
<route name="最新" author="suprio" example="/qdaily" path="/qdaily/index" />
### 多抓鱼
<route name="搜索结果" author="fengkx" example="/duozhuayu/search/JavaScript" path="/duozhuayu/search/:wd" :paramsDesc="['搜索关键词']"/>
@@ -2823,3 +2825,11 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
### 政府
<route name="最新政策" author="SettingDust" example="/gov/zhengce/zuixin" path="/gov/zhengce/zuixin"/>
### 惠誉评级
<route name="板块信息" author="LogicJake" example="/fitchratings/site/economics" path="/fitchratings/site/:type" :paramsDesc="['板块名称,在网址site后面']"/>
### 移动支付网
<route name="新闻" author="LogicJake" example="/mpaypass/news" path="/mpaypass/news"/>
+10 -3
View File
@@ -497,6 +497,7 @@ router.get('/bugly/changelog/:platform', require('./routes/tencent/bugly/changel
// wechat
router.get('/wechat/wasi/:id', require('./routes/tencent/wechat/wasi'));
router.get('/wechat/wemp/:id', require('./routes/tencent/wechat/wemp'));
router.get('/wechat/announce', require('./routes/tencent/wechat/announce'));
router.get('/wechat/miniprogram/plugins', require('./routes/tencent/wechat/miniprogram/plugins'));
@@ -744,6 +745,9 @@ router.get('/kirara/news', require('./routes/kirara/news'));
router.get('/dytt', require('./routes/dytt/index'));
router.get('/dytt/index', require('./routes/dytt/index')); // 兼容
// 人生05电影网
router.get('/rs05/rs05', require('./routes/rs05/rs05'));
// 趣头条
router.get('/qutoutiao/category/:cid', require('./routes/qutoutiao/category'));
@@ -979,9 +983,6 @@ router.get('/icourse163/newest', require('./routes/icourse163/newest'));
// patchwork.kernel.org
router.get('/patchwork.kernel.org/comments/:id', require('./routes/patchwork.kernel.org/comments'));
// qdaily
router.get('/qdaily', require('./routes/qdaily/index'));
// 京东众筹
router.get('/jingdong/zhongchou/:type/:status/:sort', require('./routes/jingdong/zhongchou'));
@@ -1006,4 +1007,10 @@ router.get('/gov/zhengce/zuixin', require('./routes/gov/zhengce/zuixin'));
// 小黑盒
router.get('/xiaoheihe/user/:id', require('./routes/xiaoheihe/user'));
// 惠誉评级
router.get('/fitchratings/site/:type', require('./routes/fitchratings/site'));
// 移动支付
router.get('/mpaypass/news', require('./routes/mpaypass/news'));
module.exports = router;
+33
View File
@@ -0,0 +1,33 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const type = ctx.params.type;
const link = `https://www.fitchratings.com/site/${type}`;
const listData = await axios.get(link);
const $list = cheerio.load(listData.data);
ctx.state.data = {
title: `${type} - 惠誉评级`,
link,
item: await Promise.all(
$list('div.card-text-container')
.slice(0, 10)
.map(async (_, el) => {
const $el = $list(el);
const $a = $el.find('h4 a');
const href = $a.attr('href');
const title = $a.text();
const description = $el.find('div p').text();
return {
title: title,
description,
link: href,
};
})
.get()
),
};
};
+1 -1
View File
@@ -29,7 +29,7 @@ module.exports = async (ctx) => {
.map((item) => ({
title: item.title,
description: md.render(item.body) || 'No description',
pubDate: new Date(item.created_at),
pubDate: new Date(item.created_at).toUTCString(),
link: `${host}/${item.number}`,
})),
};
+2 -1
View File
@@ -27,11 +27,12 @@ module.exports = async (ctx) => {
const items = feeds.map((element) => {
const date = new Date(element.feed.created * 1000);
const video = element.feed.clazz === 'video' ? 'clazz=video&' : '';
const link = element.feed.clazz === 'bbsPost' ? 'bbspost/detail' : `article/${game}`;
return {
title: element.feed.title,
description: element.feed.description,
pubDate: `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`,
link: `${host}/web/article/${game}/${element.feed.sourceID.split('/')[0]}?${video}title=${encodeURI(element.feed.seedTitle)}&remark=seed`,
link: `${host}/web/${link}/${element.feed.sourceID.split('/')[0]}?${video}title=${encodeURI(element.feed.seedTitle)}&remark=seed`,
};
});
+46
View File
@@ -0,0 +1,46 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const link = `http://m.mpaypass.com.cn/`;
const listData = await axios.get(link);
const $list = cheerio.load(listData.data);
ctx.state.data = {
title: `新闻 - 移动支付网`,
link,
item: await Promise.all(
$list('.newsbodylist')
.map(async (_, el) => {
const $el = $list(el);
const $a = $el.find('.newsbodylist-title a');
const href = $a.attr('href');
const title = $a.text();
const date = $el
.find('.newsbodylist-title span')
.text()
.split('|')[1];
const key = `${href}`;
let description;
const value = await ctx.cache.get(key);
if (value) {
description = value;
} else {
const contentData = await axios.get(href);
const $content = cheerio.load(contentData.data);
description = $content('.newsbody').html();
ctx.cache.set(key, description, 24 * 60 * 60);
}
return {
title: title,
description,
link: href,
pubDate: new Date(date).toUTCString(),
};
})
.get()
),
};
};
-33
View File
@@ -1,33 +0,0 @@
const axios = require('../../utils/axios');
const utils = require('./utils');
const Parser = require('rss-parser');
const parser = new Parser();
module.exports = async (ctx) => {
const feed = await parser.parseURL('http://www.qdaily.com/feed.xml');
const items = await Promise.all(
feed.items.splice(0, 10).map(async (item) => {
const response = await axios({
method: 'get',
url: item.link,
});
const description = utils.ProcessFeed(response.data);
const single = {
title: item.title,
link: item.link,
description,
pubDate: item.pubDate,
};
return Promise.resolve(single);
})
);
ctx.state.data = {
title: '好奇心日报',
link: 'http://www.qdaily.com',
description: '好奇心日报以商业视角观察生活并启发你的好奇心,囊括商业报道、科技新闻、生活方式等各个领域,致力成为这个时代最好的媒体,为用户提供最好的新闻资讯。',
item: items,
};
};
-31
View File
@@ -1,31 +0,0 @@
const cheerio = require('cheerio');
const ProcessFeed = (data) => {
const $ = cheerio.load(data);
const content = $('div.article-detail-bd');
// remove useless DOMs
content.find('div.com-share-favor').each((i, e) => {
$(e).remove();
});
if ($('div.article-detail-hd img.banner').length > 0) {
// there is a cover photo
const cover = $('div.article-detail-hd img.banner');
$(cover).insertBefore(content[0].firstChild);
}
if ($('div.author').length > 0) {
// credit to original author and translators
const author = $('div.author span.name');
const pub_date = $('div.author span.date');
$(author).insertAfter(content[0].lastChild);
$(pub_date).insertAfter(content[0].lastChild);
}
return content.html();
};
module.exports = {
ProcessFeed,
};
+36
View File
@@ -0,0 +1,36 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: 'http://www.rs05.com/movie/',
headers: {
Referer: 'http://www.rs05.com/movie/',
},
});
const data = response.data;
const $ = cheerio.load(data);
const list = $('.list ul li');
ctx.state.data = {
title: '人生05电影更新列表',
link: 'http://www.rs05.com/movie/',
description: '人生05电影更新列表',
item:
list &&
list
.map((index, item) => {
item = $(item);
return {
title: item.find('.intro h2 a').attr('title'),
description: item.find('.brief').text() + '<img src="' + item.find('.movie-thumbnails .pure-img').attr('data-original') + '">',
pubDate: new Date(item.find('.time').data('shared-at')).toUTCString(),
link: item.find('.intro h2 a').attr('href'),
};
})
.get(),
};
};
+50
View File
@@ -0,0 +1,50 @@
const axios = require('../../../utils/axios');
const cheerio = require('cheerio');
// const timezone = require('../../utils/timezone');
module.exports = async (ctx) => {
const { id } = ctx.params;
const response = await axios.get(`https://wemp.app/accounts/${id}`);
const $ = cheerio.load(response.data);
const author = $('.mp-info__title')
.text()
.trim();
const year = new Date().getFullYear();
const items = $('.post-item__main')
.slice(0, 10)
.get()
.map((e) => ({
title: $(e)
.find('.post-item__title')
.text()
.trim(),
link: `https://wemp.app${$(e)
.find('.post-item__title')
.attr('href')}`,
pubDate: timezone(
`${year} ${$(e)
.find('.post-item__date')
.text()
.trim()}`,
8
),
author,
}));
// to be replaced
function timezone(html, timezone) {
return new Date(new Date(html).getTime() - 60 * 60 * 1000 * (timezone + new Date().getTimezoneOffset() / 60)).toUTCString();
}
ctx.state.data = {
title: `微信公众号 - ${author}`,
link: `https://wemp.app/accounts/${id}/`,
description: $('.mp-info__value')
.text()
.trim(),
item: items,
};
};
+5 -5
View File
@@ -31,9 +31,9 @@
"devDependencies": {
"axios-mock-adapter": "1.16.0",
"eslint": "5.12.1",
"eslint-config-prettier": "3.6.0",
"eslint-config-prettier": "4.0.0",
"eslint-plugin-prettier": "3.0.1",
"jest": "23.6.0",
"jest": "24.0.0",
"lint-staged": "8.1.0",
"mockdate": "2.0.2",
"nodemon": "1.18.9",
@@ -46,7 +46,7 @@
"dependencies": {
"art-template": "4.13.2",
"axios": "0.18.0",
"axios-retry": "3.1.1",
"axios-retry": "3.1.2",
"cheerio": "1.0.0-rc.2",
"co-redis": "2.1.1",
"currency-symbol-map": "^4.0.4",
@@ -58,7 +58,7 @@
"iconv-lite": "0.4.24",
"imgur": "^0.3.1",
"json-bigint": "0.3.0",
"koa": "2.6.2",
"koa": "2.7.0",
"koa-basic-auth": "^4.0.0",
"koa-favicon": "2.0.1",
"koa-mount": "^4.0.0",
@@ -77,7 +77,7 @@
"sharp": "^0.21.0",
"socks-proxy-agent": "^4.0.1",
"twit": "2.2.11",
"winston": "3.1.0"
"winston": "3.2.0"
},
"engines": {
"node": ">=8.0.0"
+752 -656
View File
File diff suppressed because it is too large Load Diff