rss: add smzdm ranking

This commit is contained in:
DIYgod 2018-06-25 19:07:13 +08:00
parent 24586a42de
commit db621a9b0b
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
4 changed files with 86 additions and 1 deletions

View File

@ -137,7 +137,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
- 新闻早报
- UU 看书
- 小说章节
- 3dm
- 3DMGame
- 新闻中心
- 新闻
- 攻略
@ -148,6 +148,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
- Lookup Torrents by IMDB ID根据 IMDB ID 查找种子)
- 什么值得买
- 关键词
- 排行榜
- 上海海事大学
- 学术讲座
- 通知公告

View File

@ -1174,6 +1174,54 @@ id, 专辑 id, 可在对应专辑页面的 URL 中找到
参数: keyword你想订阅的关键词
### 排行榜
举例: [https://rsshub.app/smzdm/ranking/pinlei/11/3](https://rsshub.app/smzdm/ranking/pinlei/11/3)
路由: `/smzdm/ranking/:rank_type/:rank_id/:hour`
参数
**rank_type**
| 好价品类榜 | 好价电商榜 | 海淘 TOP 榜 | 好文排行榜 | 好物排行榜 |
| ---------- | ---------- | ----------- | ---------- | ---------- |
| pinlei | dianshang | haitao | haowen | haowu |
**rank_id**
好价品类榜
| 全部 | 时尚运动 | 3C 家电 | 食品家居 | 日百母婴 | 出行游玩 | 白菜 | 凑单品 |
| ---- | -------- | ------- | -------- | -------- | -------- | ---- | ------ |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 |
好价电商榜
| 券活动 | 京东 | 天猫 | 亚马逊中国 | 国美在线 | 苏宁易购 | 网易 | 西集网 | 美国亚马逊 | 日本亚马逊 | ebay |
| ------ | ---- | ---- | ---------- | -------- | -------- | ---- | ------ | ---------- | ---------- | ---- |
| 24 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
海淘 TOP 榜
| 全部 | 海外直邮 | 美国榜 | 欧洲榜 | 澳新榜 | 亚洲榜 | 晒物榜 |
| ---- | -------- | ------ | ------ | ------ | ------ | ------ |
| 39 | 34 | 35 | 36 | 37 | 38 | hsw |
好文排行榜
| 原创 | 资讯 |
| ---- | ---- |
| yc | zx |
好物排行榜
| 新晋榜 | 消费众测 | 新锐品牌 | 好物榜单 |
| ------ | -------- | -------- | -------- |
| hwall | zc | nb | hw |
**hour**: 时间跨度
## 上海海事大学
### 学术讲座

View File

@ -297,6 +297,7 @@ router.get('/eztv/torrents/:imdb_id', require('./routes/eztv/imdb'));
// 什么值得买
router.get('/smzdm/keyword/:keyword', require('./routes/smzdm/keyword'));
router.get('/smzdm/ranking/:rank_type/:rank_id/:hour', require('./routes/smzdm/ranking'));
// SHMTU
router.get('/shmtu/events', require('./routes/shmtu/events'));

35
routes/smzdm/ranking.js Normal file
View File

@ -0,0 +1,35 @@
const axios = require('../../utils/axios');
const config = require('../../config');
module.exports = async (ctx) => {
const { rank_type, rank_id, hour } = ctx.params;
const response = await axios({
method: 'get',
url: `https://www.smzdm.com/top/json_more?rank_type=${rank_type}&rank_id=${rank_id}&hour=${hour}`,
headers: {
'User-Agent': config.ua,
Referer: 'https://www.smzdm.com/top/',
},
});
const data = response.data.data.list;
const list1 = [];
const list2 = [];
for (let i = 0; i < 6; i++) {
list1.push(data[i][0]);
list2.push(data[i][1]);
}
const list = [...list1, ...list2];
ctx.state.data = {
title: `${rank_type}榜-${rank_id}-${hour}小时`,
link: 'https://www.smzdm.com/top/',
item: list.map((item) => ({
title: `${item.article_title} - ${item.article_price}`,
description: `${item.article_title} - ${item.article_price}<br><img referrerpolicy="no-referrer" src="${item.article_pic}">`,
pubDate: new Date(item.article_pubdate).toUTCString(),
link: item.article_url,
})),
};
};