Skip to content

Commit

Permalink
feat(route): sina us stock and rollnews (DIYgod#12493)
Browse files Browse the repository at this point in the history
* refactor: migrate to v2

* refactor: generic rollnews

* docs: merge docs

* refactor: discovery use common utilities

* refactor: china finance use utilities

* refactor: csj use utils

* feat: us stock

* feat: add radar

* docs: mention default value

* docs: fix build
  • Loading branch information
TonyRL authored May 11, 2023
1 parent 0267e2c commit d398081
Show file tree
Hide file tree
Showing 21 changed files with 420 additions and 266 deletions.
6 changes: 0 additions & 6 deletions docs/finance.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,6 @@ TokenInsight 官方亦有提供 RSS,可参考 <https://api.tokeninsight.com/re

</Route>

## 新浪财经

### 新浪财经-国內

<Route author="yubinbai" example="/sina/finance" path="/sina/finance" />

## 雪球

### 今日话题
Expand Down
56 changes: 53 additions & 3 deletions docs/new-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -4454,11 +4454,61 @@ wechat-feeds 来源[已停止更新](https://github.com/hellodword/wechat-feeds/

<Route author="nczitzk" example="/news/whxw" path="/news/whxw"/>

## 新浪专栏
## 新浪

### 创事记
### 科技 - 科学探索

<Route author="xapool" example="/sina/csj" path="/sina/csj"/>
<Route author="LogicJake" example="/sina/discovery/zx" path="/sina/discovery/:type" :paramsDesc="['订阅分区类型,见下表']" radar="1">

| 最新 | 天文航空 | 动物植物 | 自然地理 | 历史考古 | 生命医学 | 生活百科 | 科技前沿 |
| ---- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| zx | twhk | dwzw | zrdl | lskg | smyx | shbk | kjqy |

</Route>

### 滚动新闻

<Route author="xyqfer" example="/sina/rollnews" path="/sina/rollnews/:lid?" :paramsDesc="['分区 id,可在 URL 中找到,默认为 `2509`']" radar="1">

| 全部 | 国内 | 国际 | 社会 | 体育 | 娱乐 | 军事 | 科技 | 财经 | 股市 | 美股 |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| 2509 | 2510 | 2511 | 2669 | 2512 | 2513 | 2514 | 2515 | 2516 | 2517 | 2518 |

</Route>

### 体育 - 综合

<Route author="nczitzk" example="/sina/sports/volley" path="/sina/sports/:type" :paramsDesc="['运动类型,见下表']" radar="1">

| 排球 | 游泳 | 乒乓球 | 羽毛球 | 台球 | 田径 | 体操 | 冰雪 | 射击 | 马术 | 拳击搏击 | UFC | 其他 |
| ------ | ---- | -------- | ------ | ------- | -------- | ----- | ------ | ---- | ----- | -------- | --- | ------ |
| volley | swim | pingpang | badmin | snooker | tianjing | ticao | winter | sh | horse | kungfu | ufc | others |

</Route>

### 财经-国內

<Route author="yubinbai" example="/sina/finance/china" path="/sina/finance/china/:lid?" :paramsDesc="['分区 id,见下表,默认为 `1686`']" radar="1">

| 国内滚动 | 宏观经济 | 金融新闻 | 地方经济 | 部委动态 | 今日财经 TOP10 |
| -------- | -------- | -------- | -------- | -------- | -------------- |
| 1686 | 1687 | 1690 | 1688 | 1689 | 3231 |

</Route>

### 美股

<Route author="TonyRL" example="/sina/finance/stock/usstock" path="/sina/finance/stock/usstock/:cids?" :paramsDesc="['分区 id,见下表,默认为 `57045`']" radar="1">

| 最新报道 | 中概股 | 国际财经 | 互联网 |
| -------- | ------ | -------- | ------ |
| 57045 | 57046 | 56409 | 40811 |

</Route>

### 专栏 - 创事记

<Route author="xapool" example="/sina/csj" path="/sina/csj" radar="1"/>

## 选股宝

Expand Down
30 changes: 0 additions & 30 deletions docs/traditional-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -2413,36 +2413,6 @@ category 对应的关键词有

<Route author="yhkang" example="/cztv/zjxwlb/daily" path="/cztv/zjxwlb/daily" />

## 新浪科技

### 科学探索

<Route author="LogicJake" example="/sina/discovery/zx" path="/sina/discovery/:type" :paramsDesc="['订阅分区类型']">

分类:

| zx | twhk | dwzw | zrdl | lskg | smyx | shbk | kjqy |
| ---- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
| 最新 | 天文航空 | 动物植物 | 自然地理 | 历史考古 | 生命医学 | 生活百科 | 科技前沿 |

</Route>

### 滚动新闻

<Route author="xyqfer" example="/sina/rollnews" path="/sina/rollnews" />

## 新浪体育

### 综合

<Route author="nczitzk" example="/sina/sports/volley" path="/sina/sports/:type" :paramsDesc="['运动类型,见下表']">

| 排球 | 游泳 | 乒乓球 | 羽毛球 | 台球 | 田径 | 体操 | 冰雪 | 射击 | 马术 | 拳击搏击 | UFC | 其他 |
| ------ | ---- | -------- | ------ | ------- | -------- | ----- | ------ | ---- | ----- | -------- | --- | ------ |
| volley | swim | pingpang | badmin | snooker | tianjing | ticao | winter | sh | mashu | kungfu | ufc | others |

</Route>

## 新唐人电视台

### 频道
Expand Down
10 changes: 5 additions & 5 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1247,19 +1247,19 @@ router.get('/fitchratings/site/:type', lazyloadRouteHandler('./routes/fitchratin
// router.get('/mpaypass/main/:type?', lazyloadRouteHandler('./routes/mpaypass/main'));

// 新浪科技探索
router.get('/sina/discovery/:type', lazyloadRouteHandler('./routes/sina/discovery'));
// router.get('/sina/discovery/:type', lazyloadRouteHandler('./routes/sina/discovery'));

// 新浪科技滚动新闻
router.get('/sina/rollnews', lazyloadRouteHandler('./routes/sina/rollnews'));
// router.get('/sina/rollnews', lazyloadRouteHandler('./routes/sina/rollnews'));

// 新浪体育
router.get('/sina/sports/:type', lazyloadRouteHandler('./routes/sina/sports'));
// router.get('/sina/sports/:type', lazyloadRouteHandler('./routes/sina/sports'));

// 新浪专栏创事记
router.get('/sina/csj', lazyloadRouteHandler('./routes/sina/chuangshiji'));
// router.get('/sina/csj', lazyloadRouteHandler('./routes/sina/chuangshiji'));

// 新浪财经-国內
router.get('/sina/finance', lazyloadRouteHandler('./routes/sina/finance'));
// router.get('/sina/finance', lazyloadRouteHandler('./routes/sina/finance'));

// Animen
router.get('/animen/news/:type', lazyloadRouteHandler('./routes/animen/news'));
Expand Down
38 changes: 0 additions & 38 deletions lib/routes/sina/chuangshiji.js

This file was deleted.

52 changes: 0 additions & 52 deletions lib/routes/sina/discovery.js

This file was deleted.

37 changes: 0 additions & 37 deletions lib/routes/sina/finance.js

This file was deleted.

41 changes: 0 additions & 41 deletions lib/routes/sina/rollnews.js

This file was deleted.

54 changes: 0 additions & 54 deletions lib/routes/sina/sports.js

This file was deleted.

17 changes: 17 additions & 0 deletions lib/v2/sina/chuangshiji.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { getRollNewsList, parseRollNewsList, parseArticle } = require('./utils');

module.exports = async (ctx) => {
const pageid = '402';
const lid = '2559';
const { limit = '50' } = ctx.query;
const response = await getRollNewsList(pageid, lid, limit);
const list = parseRollNewsList(response.data.result.data);

const out = await Promise.all(list.map((item) => parseArticle(item, ctx.cache.tryGet)));

ctx.state.data = {
title: '新浪专栏-创事记',
link: 'https://tech.sina.com.cn/chuangshiji',
item: out,
};
};
Loading

0 comments on commit d398081

Please sign in to comment.