feat(route): add runtrail (#12963)

This commit is contained in:
Tony 2023-08-10 03:18:07 +08:00 committed by GitHub
parent 3432b148d6
commit d1457e3ab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 22 deletions

View File

@ -481,7 +481,7 @@ pageClass: routes
### Headline
<Route author="nczitzk" example="/fashionnetwork/headline" path="/fashionnetwork/headline/:country?" :paramsDesc="['国家,见下表,默认为 `ww`']">
<Route author="nczitzk" example="/fashionnetwork/headline" path="/fashionnetwork/headline/:country?" :paramsDesc="['国家,见下表,默认为 `ww`']">
</Route>
### News
@ -904,7 +904,7 @@ Edition
::: tip 提示
在 Matataki 发表的文章会上传到星际文件系统IPFS永久保存。即使站内文章因为各种原因消失用 RSS 获取过带 IPFS 连接的 Feed Item 的话,还是可以从 RSS 阅读器找回文章的。
在 Matataki 发表的文章会上传到星际文件系统IPFS永久保存。即使站内文章因为各种原因消失用 RSS 获取过带 IPFS 连接的 Feed Item 的话,还是可以从 RSS 阅读器找回文章的。
IPFS 网关有可能失效,那时候换成其他网关。
:::
@ -3113,50 +3113,50 @@ column 为 third 时可选的 category:
- 人工智能
| 学术 | 开发者 |
| -------- | -------- |
| 学术 | 开发者 |
| -------- | -------- |
| academic | yanxishe |
- 数智化
| 零售数智化 | 金融数智化 | 工业数智化 | 医疗数智化 | 城市数智化 |
| ---------- | ---------- | ---------- | ---------- | ----------- |
| 零售数智化 | 金融数智化 | 工业数智化 | 医疗数智化 | 城市数智化 |
| ---------- | ---------- | ---------- | ---------- | ----------- |
| redigital | findigital | mandigital | medigital | citydigital |
- 金融科技
| 科技巨头 | 银行 AI | 金融云 | 风控与安全 |
| -------- | ------- | ------------ | ------------ |
| 科技巨头 | 银行 AI | 金融云 | 风控与安全 |
| -------- | ------- | ------------ | ------------ |
| BigTech | bank | FinanceCloud | DataSecurity |
- 医疗科技
| 医疗 AI | 投融资 | 医疗器械 | 互联网医疗 | 生物医药 | 健康险 |
| -------- | ------ | -------- | ---------------- | ------------ | ------------ |
| 医疗 AI | 投融资 | 医疗器械 | 互联网医疗 | 生物医药 | 健康险 |
| -------- | ------ | -------- | ---------------- | ------------ | ------------ |
| healthai | touzi | qixie | hulianwangyiliao | shengwuyiyao | jiankangxian |
- 芯片
| 材料设备 | 芯片设计 | 晶圆代工 | 封装测试 |
| --------- | ---------- | ------------- | --------- |
| 材料设备 | 芯片设计 | 晶圆代工 | 封装测试 |
| --------- | ---------- | ------------- | --------- |
| materials | chipdesign | manufacturing | packaging |
- 智慧城市
| 智慧安防 | 智慧教育 | 智慧交通 | 智慧社区 | 智慧零售 | 智慧政务 | 智慧地产 |
| ------------- | -------------- | ------------------- | -------------- | -------------- | --------------- | -------- |
| 智慧安防 | 智慧教育 | 智慧交通 | 智慧社区 | 智慧零售 | 智慧政务 | 智慧地产 |
| ------------- | -------------- | ------------------- | -------------- | -------------- | --------------- | -------- |
| smartsecurity | smarteducation | smarttransportation | smartcommunity | smartretailing | smartgovernment | proptech |
- 工业互联网
| 工业软件 | 工业安全 | 5G 工业互联网 | 工业转型实践 |
| ---------- | -------- | ------------- | ------------ |
| 工业软件 | 工业安全 | 5G 工业互联网 | 工业转型实践 |
| ---------- | -------- | ------------- | ------------ |
| gysoftware | gysafety | 5ggy | gypratice |
- AIoT
| 物联网 | 智能硬件 | 机器人 | 智能家居 |
| ------ | -------- | ------ | --------- |
| 物联网 | 智能硬件 | 机器人 | 智能家居 |
| ------ | -------- | ------ | --------- |
| 5G | arvr | robot | smarthome |
</Route>
@ -3574,6 +3574,12 @@ column 为 third 时可选的 category:
<Route author="qiwihui" example="/paidai/news" path="/paidao/news" />
## 跑野大爆炸
### 最新文章
<Route author="TonyRL" example="/runtrail" path="/runtrail" radar="1" rssbud="1"/>
## 品途商业评论
### 文章
@ -3608,8 +3614,8 @@ column 为 third 时可选的 category:
- `fulltext`,全文输出,例如:`/pingwest/tag/ChinaJoy/1/fulltext`
::: tip 提示
该路由一次最多显示 30 条文章
::: tip 提示
该路由一次最多显示 30 条文章
:::
</Route>
@ -4200,7 +4206,7 @@ column 为 third 时可选的 category:
<Route author="mjysci" example="/163/dy2/T1555591616739" path="/163/dy2/:id" :paramsDesc="['id该网易号主页网址最后一项html的文件名']" anticrawler="1"/>
优先使用方法一,若是网易号搜索页面搜不到的小众网易号(文章页面不含`data-wemediaid`)则可使用此法。
优先使用方法一,若是网易号搜索页面搜不到的小众网易号(文章页面不含`data-wemediaid`)则可使用此法。
触发反爬会只抓取到标题,建议自建。
## 网易新闻
@ -4948,7 +4954,7 @@ column 为 third 时可选的 category:
### 军事 - 军事新闻
<Route author="jiaaoMario" example="/china/news/military" path="/china/news/military">
<Route author="jiaaoMario" example="/china/news/military" path="/china/news/military">
</Route>
### 时事新闻

View File

@ -0,0 +1,4 @@
module.exports = {
'': ['TonyRL'],
'/': ['TonyRL'],
};

34
lib/v2/runtrail/posts.js Normal file
View File

@ -0,0 +1,34 @@
const got = require('@/utils/got');
const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const baseUrl = 'https://runtrail.cn';
const { data: response } = await got(`${baseUrl}/wp-json/wp/v2/posts`, {
searchParams: {
_embed: true,
per_page: ctx.query.limit ? parseInt(ctx.query.limit) : 30,
},
});
let data = response;
if (typeof response !== 'object') {
// remove php warnings before JSON
data = JSON.parse(response.match(/\[(.*)\]/)[0]);
}
const items = data.map((item) => ({
title: item.title.rendered,
description: item.content.rendered,
pubDate: parseDate(item.date_gmt),
updated: parseDate(item.modified_gmt),
author: item._embedded.author.map((a) => a.name).join(', '),
category: item._embedded['wp:term'][0].map((c) => c.name),
link: item.link,
}));
ctx.state.data = {
title: '最新文章 - 跑野大爆炸',
link: baseUrl,
item: items,
};
};

13
lib/v2/runtrail/radar.js Normal file
View File

@ -0,0 +1,13 @@
module.exports = {
'runtrail.cn': {
_name: '跑野大爆炸',
'.': [
{
title: '最新文章',
docs: 'https://docs.rsshub.app/new-media.html#pao-ye',
source: ['/'],
target: '/runtrail',
},
],
},
};

View File

@ -0,0 +1,3 @@
module.exports = (router) => {
router.get('/', require('./posts'));
};