feat: 快媒体 生物帮 什么值得买用户文章 唧唧堂 新闻联播文字版 (#4756)

This commit is contained in:
xfangbao 2020-05-20 07:40:15 -04:00 committed by GitHub
parent 6c740c4e31
commit 019cf12740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 400 additions and 0 deletions

View File

@ -1120,3 +1120,28 @@ QueryString:
### 全文
<Route author="HenryQW" example="/zzz" path="/zzz/index"/>
## 快媒体
### 首页更新
<Route author="xfangbao" example="/kuai" path="/kuai" />
### 具体栏目更新
<Route author="xfangbao" example="/kuai/1" path="/kuai/:id" />
具体栏目编号,去网站上看标签
| 网址 | 对应路由 |
| -------- | -------- |
| kuai.media | /kuai |
| www.kuai.media/portal.php?mod=list&catid=38 | /kuai/38 |
## 199IT
### 首页更新
<Route author="xfangbao" example="/199it" path="/199it" />

View File

@ -240,3 +240,16 @@ count 的取值范围为 1-12为防止请求次数过多推荐设置为 5
### 主页
<Route author="kt286" example="/zreading" path="/zreading" />
## 生物帮
### 所有栏目
<Route author="xfangbao" example="/biobio/nature/cell-reports" path="/biobio/:column/:id" />
具体栏目编号,去网站上看标签
| 网址 | 对应路由 |
| -------- | -------- |
| http://science.bio1000.com/ecology-environment | /biobio/science/ecology-environment |
| http://www.bio1000.com/gnjz | /biobio/gnjz |

View File

@ -181,6 +181,10 @@ For instance, in <https://www.leboncoin.fr/recherche/?**category=10&locations=Pa
</Route>
### 用户文章
<Route author="xfangbao" example="/smzdm/article/6902738986" path="/smzdm/article/:uid" :paramsDesc="['用户id网址上直接可以看到']"/>
## 淘宝众筹
### 众筹项目

View File

@ -287,3 +287,14 @@ pageClass: routes
### 通知公告
<Route author="nczitzk" example="/cpta/notice" path="/cpta/notice" />
## 唧唧堂
### 论文
<Route author="xfangbao" example="/jijitang/publication" path="/jijitang/publication/" />
### 文档
<Route author="xfangbao" example="/jijitang/article/latest" path="/jijitang/article/:id" :paramsDesc="['类别latest 或者 recommand']"/>

View File

@ -509,6 +509,11 @@ category 对应的关键词有
<Route author="luyuhuang" example="/xinwenlianbo/index" path="/xinwenlianbo/index" radar="1"/>
### 新闻联播文字版全文
<Route author="xfangbao" example="/xwlb" path="/xwlb/index" />
## 朝日新聞中文網(繁體中文版)
### 新聞分類
@ -612,3 +617,4 @@ category 对应的关键词有
| article | blog | culture | reports |
</Route>

View File

@ -322,6 +322,7 @@ router.get('/smzdm/keyword/:keyword', require('./routes/smzdm/keyword'));
router.get('/smzdm/ranking/:rank_type/:rank_id/:hour', require('./routes/smzdm/ranking'));
router.get('/smzdm/haowen/:day?', require('./routes/smzdm/haowen'));
router.get('/smzdm/haowen/fenlei/:name/:sort?', require('./routes/smzdm/haowen_fenlei'));
router.get('/smzdm/article/:uid', require('./routes/smzdm/article'));
// 新京报
router.get('/bjnews/:cat', require('./routes/bjnews/news'));
@ -2694,6 +2695,24 @@ router.get('/umass/amherst/csnews', require('./routes/umass/amherst/csnews'));
// 飘花电影网
router.get('/piaohua/hot', require('./routes/piaohua/hot'));
// 快媒体
router.get('/kuai', require('./routes/kuai/index'));
router.get('/kuai/:id', require('./routes/kuai/id'));
// 生物帮
router.get('/biobio/:id', require('./routes/biobio/index'));
router.get('/biobio/:column/:id', require('./routes/biobio/others'));
// 199it
router.get('/199it', require('./routes/199it/index'));
// 唧唧堂
router.get('/jijitang/article/:id', require('./routes/jijitang/article'));
router.get('/jijitang/publication', require('./routes/jijitang/publication'));
// 新闻联播
router.get('/xwlb', require('./routes/xwlb/index'));
// 网易新闻专栏
router.get('/netease/news/special/:type?', require('./routes/netease/news/special'));

33
lib/routes/199it/index.js Normal file
View File

@ -0,0 +1,33 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `http://www.199it.com/newly`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('.entry-content').get();
const out = await Promise.all(
list.slice(0, 9).map(async (item) => {
const $ = cheerio.load(item);
const time = $('.post-time time').attr('datetime');
const title = $('.entry-title a').attr('title');
const partial = $('.entry-title a').attr('href');
const address = partial;
const single = {
title,
pubDate: new Date(time).toUTCString(),
link: address,
guid: address,
};
ctx.cache.set(address, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: '199it',
link: url,
item: out,
};
};

View File

@ -0,0 +1,40 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `http://www.bio1000.com/${ctx.params.id}`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('.excerpt-1').get();
const out = await Promise.all(
list.slice(0, 5).map(async (item) => {
const $ = cheerio.load(item);
const time = $('.meta').text();
const title = $('header h2 a').attr('title');
const partial = $('header h2 a').attr('href');
const address = partial;
const cache = await ctx.cache.get(address);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await got.get(address);
const get = cheerio.load(res.data);
const contents = get('.article-content').html();
const single = {
title,
pubDate: time,
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,
};
};

View File

@ -0,0 +1,40 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `http://${ctx.params.column}.bio1000.com/${ctx.params.id}`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('.excerpt-1').get();
const out = await Promise.all(
list.slice(0, 5).map(async (item) => {
const $ = cheerio.load(item);
const time = $('.meta').text();
const title = $('header h2 a').attr('title');
const partial = $('header h2 a').attr('href');
const address = partial;
const cache = await ctx.cache.get(address);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await got.get(address);
const get = cheerio.load(res.data);
const contents = get('.article-content').html();
const single = {
title,
pubDate: time,
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,
};
};

View File

@ -0,0 +1,19 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const id = ctx.params.id;
const url = `http://www.jijitang.com/article/list?sort=${id}`;
const res = await got.get(url);
const data = res.data;
ctx.state.data = {
title: `唧唧堂 ${id}`,
link: url,
item: data.map((item) => ({
title: item.title,
description: item.content,
pubDate: item.createTime,
link: `http://www.jijitang.com/article/${item._id}`,
})),
};
};

View File

@ -0,0 +1,18 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `http://www.jijitang.com/api/publication/search?start=0&limit=40`;
const res = await got.get(url);
const data = res.data;
ctx.state.data = {
title: `唧唧堂 publication`,
link: url,
item: data.result.map((item) => ({
title: item.titleCn,
description: `杂志名称:` + item.journalName + `<br/> 英文标题:` + item.title + `<br/> 摘要:` + item.summary,
pubDate: item.created,
link: item.fullArticleLink,
})),
};
};

38
lib/routes/kuai/id.js Normal file
View File

@ -0,0 +1,38 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `https://www.kuai.media/portal.php?mod=list&catid=${ctx.params.id}`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('.data_row').get();
const out = await Promise.all(
list.slice(0, 40).map(async (item) => {
const $ = cheerio.load(item);
const title = $('.news_title h3 a').text();
const partial = $('.news_title h3 a').attr('href');
const address = `https://www.kuai.media/${partial}`;
const cache = await ctx.cache.get(address);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await got.get(address);
const get = cheerio.load(res.data);
const contents = get('.s').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,
};
};

38
lib/routes/kuai/index.js Normal file
View File

@ -0,0 +1,38 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `https://www.kuai.media/portal.php?mod=list&catid=0`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('.data_row').get();
const out = await Promise.all(
list.slice(0, 40).map(async (item) => {
const $ = cheerio.load(item);
const title = $('.news_title h3 a').text();
const partial = $('.news_title h3 a').attr('href');
const address = `https://www.kuai.media/${partial}`;
const cache = await ctx.cache.get(address);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await got.get(address);
const get = cheerio.load(res.data);
const contents = get('.s').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,
};
};

View File

@ -0,0 +1,56 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const date = require('@/utils/date');
module.exports = async (ctx) => {
const link = `https://zhiyou.smzdm.com/member/${ctx.params.uid}/article/`;
const response = await got.get(link);
const $ = cheerio.load(response.data);
const title = $('.info-stuff-nickname').text();
const list = $('.pandect-content-stuff')
.slice(0, 10)
.map(function () {
const info = {
title: $(this).find('.pandect-content-title a').text(),
link: $(this).find('.pandect-content-title a').attr('href'),
pubdate: $(this).find('.pandect-content-time').text(),
};
return info;
})
.get();
const out = await Promise.all(
list.map(async (info) => {
const title = info.title;
const pubdate = info.pubdate;
const itemUrl = info.link;
const cache = await ctx.cache.get(itemUrl);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const response = await got.get(itemUrl);
const $ = cheerio.load(response.data);
const content = $('.m-contant article');
const description = content.html();
const single = {
title: title,
link: itemUrl,
description: description,
pubDate: date(pubdate),
};
ctx.cache.set(itemUrl, JSON.stringify(single));
return Promise.resolve(single);
})
);
ctx.state.data = {
title: `${title}-什么值得买`,
link: link,
item: out,
};
};

40
lib/routes/xwlb/index.js Normal file
View File

@ -0,0 +1,40 @@
const cheerio = require('cheerio');
const got = require('@/utils/got');
module.exports = async (ctx) => {
const url = `http://www.xwlb.net.cn/video.html`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const list = $('.post_body').get();
const out = await Promise.all(
list.slice(0, 2).map(async (item) => {
const $ = cheerio.load(item);
const title = $('h2 a').attr('title');
const partial = $('h2 a').attr('href');
const address = partial;
const cache = await ctx.cache.get(address);
if (cache) {
return Promise.resolve(JSON.parse(cache));
}
const res = await got.get(address);
const get = cheerio.load(res.data);
const contents = get('.content').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: $('title').text(),
link: url,
item: out,
};
};