Skip to content

Commit

Permalink
Merge pull request #773 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Jan 31, 2023
2 parents 43a6697 + 3a47393 commit e7cfa2a
Show file tree
Hide file tree
Showing 24 changed files with 521 additions and 39 deletions.
16 changes: 16 additions & 0 deletions docs/new-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ pageClass: routes

</Route>

## CoinDesk Consensus Magazine

### 新闻周刊

<Route author="jameshih" example="/coindesk/consensus-magazine" path="/coindesk/consensus-magazine"/>

## Common App

### Blog
Expand Down Expand Up @@ -4622,6 +4628,16 @@ QueryString:

</Route>

## 字节点击

### 首页

<Route author="TonyRL" example="/byteclicks" path="/byteclicks" radar="1" />

### 标签

<Route author="TonyRL" example="/byteclicks/tag/人工智能" path="/byteclicks/tag/:tag" radar="1" :paramsDesc="['标签,可在URL中找到']"/>

## 自由微信

### 公众号
Expand Down
12 changes: 12 additions & 0 deletions docs/university.md
Original file line number Diff line number Diff line change
Expand Up @@ -2802,6 +2802,18 @@ jsjxy.hbut.edu.cn 证书链不全,自建 RSSHub 可设置环境变量 NODE_TLS

</Route>

## 西安财经大学

### 教务处

<Route author="shaokeyibb" example="/xaufe/jiaowu/tzgg" path="/xaufe/jiaowu/:category?" :paramsDesc="['分类,默认为通知公告']" radar="1" rssbud="1">

| 通知公告 |
| :--: |
| tzgg |

</Route>

## 西安电子科技大学

### 教务处
Expand Down
4 changes: 2 additions & 2 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ router.get('/cpython/:pre?', lazyloadRouteHandler('./routes/cpython'));
// 小米
router.get('/mi/golden', lazyloadRouteHandler('./routes/mi/golden'));
router.get('/mi/crowdfunding', lazyloadRouteHandler('./routes/mi/crowdfunding'));
router.get('/mi/youpin/crowdfunding', lazyloadRouteHandler('./routes/mi/youpin/crowdfunding'));
router.get('/mi/youpin/new/:sort?', lazyloadRouteHandler('./routes/mi/youpin/new'));
// router.get('/mi/youpin/crowdfunding', lazyloadRouteHandler('./routes/mi/youpin/crowdfunding'));
// router.get('/mi/youpin/new/:sort?', lazyloadRouteHandler('./routes/mi/youpin/new'));
router.get('/miui/:device/:type?/:region?', lazyloadRouteHandler('./routes/mi/miui/index'));
router.get('/mi/bbs/board/:boardId', lazyloadRouteHandler('./routes/mi/board'));

Expand Down
22 changes: 22 additions & 0 deletions lib/v2/byteclicks/index.js
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,
};
};
4 changes: 4 additions & 0 deletions lib/v2/byteclicks/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
'/': ['TonyRL'],
'/tag/:tag': ['TonyRL'],
};
19 changes: 19 additions & 0 deletions lib/v2/byteclicks/radar.js
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',
},
],
},
};
4 changes: 4 additions & 0 deletions lib/v2/byteclicks/router.js
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'));
};
30 changes: 30 additions & 0 deletions lib/v2/byteclicks/tag.js
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,
};
};
13 changes: 13 additions & 0 deletions lib/v2/byteclicks/utils.js
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,
};
36 changes: 36 additions & 0 deletions lib/v2/coindesk/index.js
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,
};
};
3 changes: 3 additions & 0 deletions lib/v2/coindesk/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/consensus-magazine': ['jameshih'],
};
13 changes: 13 additions & 0 deletions lib/v2/coindesk/radar.js
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',
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/coindesk/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/consensus-magazine', require('./index'));
};
2 changes: 1 addition & 1 deletion lib/v2/linkedin/cn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const siteUrl = 'https://www.linkedin.cn/incareer/jobs/search';

module.exports = async (ctx) => {
const { title, jobs } = await parseSearchHit(ctx);
const items = await Promise.all(jobs.map((job) => parseJobPosting(job)));
const items = await Promise.all(jobs.map((job) => parseJobPosting(ctx, job)));
ctx.state.data = {
title: `领英 - ${title}`,
link: siteUrl,
Expand Down
Loading

1 comment on commit e7cfa2a

@vercel
Copy link

@vercel vercel bot commented on e7cfa2a Jan 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.