diff --git a/docs/new-media.md b/docs/new-media.md index 6c02e8884..9e105332a 100755 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -1120,3 +1120,28 @@ QueryString: ### 全文 + +## 快媒体 + +### 首页更新 + + + + +### 具体栏目更新 + + + + +具体栏目编号,去网站上看标签 + +| 网址 | 对应路由 | +| -------- | -------- | +| kuai.media | /kuai | +| www.kuai.media/portal.php?mod=list&catid=38 | /kuai/38 | + +## 199IT + +### 首页更新 + + \ No newline at end of file diff --git a/docs/reading.md b/docs/reading.md index b412b4a5d..9f0ad01fb 100644 --- a/docs/reading.md +++ b/docs/reading.md @@ -240,3 +240,16 @@ count 的取值范围为 1-12,为防止请求次数过多,推荐设置为 5 ### 主页 + +## 生物帮 + +### 所有栏目 + + + +具体栏目编号,去网站上看标签 + +| 网址 | 对应路由 | +| -------- | -------- | +| http://science.bio1000.com/ecology-environment | /biobio/science/ecology-environment | +| http://www.bio1000.com/gnjz | /biobio/gnjz | \ No newline at end of file diff --git a/docs/shopping.md b/docs/shopping.md index 9fbd271af..ca75e19f0 100644 --- a/docs/shopping.md +++ b/docs/shopping.md @@ -181,6 +181,10 @@ For instance, in +### 用户文章 + + + ## 淘宝众筹 ### 众筹项目 diff --git a/docs/study.md b/docs/study.md index 691783f1c..31afa5414 100644 --- a/docs/study.md +++ b/docs/study.md @@ -287,3 +287,14 @@ pageClass: routes ### 通知公告 + + +## 唧唧堂 + +### 论文 + + + +### 文档 + + diff --git a/docs/traditional-media.md b/docs/traditional-media.md index f327004f4..fac329c76 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -509,6 +509,11 @@ category 对应的关键词有 + +### 新闻联播文字版全文 + + + ## 朝日新聞中文網(繁體中文版) ### 新聞分類 @@ -612,3 +617,4 @@ category 对应的关键词有 | article | blog | culture | reports | + diff --git a/lib/router.js b/lib/router.js index 5247277f7..96a181b92 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/199it/index.js b/lib/routes/199it/index.js new file mode 100644 index 000000000..0b5643239 --- /dev/null +++ b/lib/routes/199it/index.js @@ -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, + }; +}; diff --git a/lib/routes/biobio/index.js b/lib/routes/biobio/index.js new file mode 100644 index 000000000..b3779e466 --- /dev/null +++ b/lib/routes/biobio/index.js @@ -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, + }; +}; diff --git a/lib/routes/biobio/others.js b/lib/routes/biobio/others.js new file mode 100644 index 000000000..8286407fc --- /dev/null +++ b/lib/routes/biobio/others.js @@ -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, + }; +}; diff --git a/lib/routes/jijitang/article.js b/lib/routes/jijitang/article.js new file mode 100644 index 000000000..bd6a1c46e --- /dev/null +++ b/lib/routes/jijitang/article.js @@ -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}`, + })), + }; +}; diff --git a/lib/routes/jijitang/publication.js b/lib/routes/jijitang/publication.js new file mode 100644 index 000000000..68a97954b --- /dev/null +++ b/lib/routes/jijitang/publication.js @@ -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 + `
英文标题:` + item.title + `
摘要:` + item.summary, + pubDate: item.created, + link: item.fullArticleLink, + })), + }; +}; diff --git a/lib/routes/kuai/id.js b/lib/routes/kuai/id.js new file mode 100644 index 000000000..e10e6e5f8 --- /dev/null +++ b/lib/routes/kuai/id.js @@ -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, + }; +}; diff --git a/lib/routes/kuai/index.js b/lib/routes/kuai/index.js new file mode 100644 index 000000000..2bb998653 --- /dev/null +++ b/lib/routes/kuai/index.js @@ -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, + }; +}; diff --git a/lib/routes/smzdm/article.js b/lib/routes/smzdm/article.js new file mode 100644 index 000000000..c51b9f176 --- /dev/null +++ b/lib/routes/smzdm/article.js @@ -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, + }; +}; diff --git a/lib/routes/xwlb/index.js b/lib/routes/xwlb/index.js new file mode 100644 index 000000000..dbda7e027 --- /dev/null +++ b/lib/routes/xwlb/index.js @@ -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, + }; +};