forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #773 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
24 changed files
with
521 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const got = require('@/utils/got'); | ||
const { parseItem } = require('./utils'); | ||
const baseUrl = 'https://byteclicks.com'; | ||
|
||
module.exports = async (ctx) => { | ||
const { data } = await got(`${baseUrl}/wp-json/wp/v2/posts`, { | ||
searchParams: { | ||
per_page: ctx.query.limit ? parseInt(ctx.query.limit) : 100, | ||
}, | ||
}); | ||
|
||
const items = parseItem(data); | ||
|
||
ctx.state.data = { | ||
title: '字节点击 - 聚合全球优质资源,跟踪世界前沿科技', | ||
description: | ||
'byteclicks.com 最专业的前沿科技网站。聚合全球优质资源,跟踪世界前沿科技,精选推荐一些很棒的互联网好资源好工具好产品。寻找有前景好项目、找论文、找报告、找数据、找课程、找电子书上byteclicks!byteclicks.com是投资人、科研学者、学生每天必看的网站。', | ||
image: 'https://byteclicks.com/wp-content/themes/RK-Blogger/images/wbolt.ico', | ||
link: baseUrl, | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
'/': ['TonyRL'], | ||
'/tag/:tag': ['TonyRL'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
'byteclicks.com': { | ||
_name: '字节点击', | ||
'.': [ | ||
{ | ||
title: '首页', | ||
docs: 'https://docs.rsshub.app/new-media.html#zi-jie-dian-ji', | ||
source: ['/'], | ||
target: '/byteclicks', | ||
}, | ||
{ | ||
title: '标签', | ||
docs: 'https://docs.rsshub.app/new-media.html#zi-jie-dian-ji', | ||
source: ['/tag/:tag'], | ||
target: '/byteclicks/tag/:tag', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = (router) => { | ||
router.get('/', require('./index')); | ||
router.get('/tag/:tag', require('./tag')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const got = require('@/utils/got'); | ||
const { parseItem } = require('./utils'); | ||
const baseUrl = 'https://byteclicks.com'; | ||
|
||
module.exports = async (ctx) => { | ||
const { tag } = ctx.params; | ||
const { data: search } = await got(`${baseUrl}/wp-json/wp/v2/tags`, { | ||
searchParams: { | ||
search: tag, | ||
per_page: 100, | ||
}, | ||
}); | ||
const tagData = search.find((item) => item.name === tag); | ||
|
||
const { data } = await got(`${baseUrl}/wp-json/wp/v2/posts`, { | ||
searchParams: { | ||
per_page: ctx.query.limit ? parseInt(ctx.query.limit) : 100, | ||
tags: tagData.id, | ||
}, | ||
}); | ||
|
||
const items = parseItem(data); | ||
|
||
ctx.state.data = { | ||
title: `${tagData.name} - 字节点击`, | ||
image: 'https://byteclicks.com/wp-content/themes/RK-Blogger/images/wbolt.ico', | ||
link: tagData.link, | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
const parseItem = (data) => | ||
data.map((item) => ({ | ||
title: item.title.rendered, | ||
description: item.content.rendered, | ||
pubDate: parseDate(item.date_gmt), | ||
link: item.link, | ||
})); | ||
|
||
module.exports = { | ||
parseItem, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const rootUrl = 'https://www.coindesk.com'; | ||
|
||
module.exports = async (ctx) => { | ||
const channel = ctx.params.channel ?? 'consensus-magazine'; | ||
|
||
const response = await got.get(`${rootUrl}/${channel}`); | ||
const $ = cheerio.load(response.data); | ||
const title = $('div.title-holder h2').text(); | ||
const content = JSON.parse( | ||
$('#fusion-metadata') | ||
.text() | ||
.match(/Fusion\.contentCache=(.*?);Fusion\.layout/)[1] | ||
); | ||
|
||
const o1 = content['websked-collections']; | ||
// Object key names are different every week | ||
const feature = o1[Object.keys(o1)[2]]; | ||
const opinion = o1[Object.keys(o1)[3]]; | ||
|
||
const list = [...feature.data, ...opinion.data]; | ||
|
||
const items = list.map((item) => ({ | ||
title: item.headlines.basic, | ||
link: rootUrl + item.canonical_url, | ||
description: title + '<br><br>' + item.subheadlines.basic, | ||
pubDate: item.publish_date, | ||
})); | ||
|
||
ctx.state.data = { | ||
title: 'CoinDesk Consensus Magazine', | ||
link: `${rootUrl}/${channel}`, | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/consensus-magazine': ['jameshih'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
'coindesk.com': { | ||
_name: 'CoinDesk', | ||
'.': [ | ||
{ | ||
title: 'Coindesk Consensus Magazine', | ||
docs: 'https://docs.rsshub.app/new-media.html#coindesk-consensus-magazine', | ||
source: ['/'], | ||
target: '/coindesk/consensus-magazine', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function (router) { | ||
router.get('/consensus-magazine', require('./index')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
e7cfa2a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rsshub-master – ./
rsshub-master-git-master-auto-bot-ty.vercel.app
rsshub-master-auto-bot-ty.vercel.app
rsshub-master.vercel.app