Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dev guduodata #8502

Merged
merged 15 commits into from
Jan 22, 2022
Merged
2 changes: 2 additions & 0 deletions docs/bbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -845,3 +845,5 @@ pageClass: routes
| 灵异事件 | 灵异图片 | 民间奇谈 |
| ------------- | ------------ | ------------ |
| lingyishijain | lingyitupian | minjianqitan |

</Route>
10 changes: 7 additions & 3 deletions docs/government.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ pageClass: routes

### 新闻公布

<Route author="linbuxiao" example="/icac/news/sc" path="/icac/news/:lang?" :paramsDesc="['语言,留空为`sc`,支持`sc`(简中),`tc`(繁中),`en`(英文)']">
<Route author="linbuxiao" example="/icac/news/sc" path="/icac/news/:lang?" :paramsDesc="['语言,留空为`sc`,支持`sc`(简中),`tc`(繁中),`en`(英文)']" />
Gem1ni marked this conversation as resolved.
Show resolved Hide resolved

## 中国工业和信息化部

Expand Down Expand Up @@ -411,12 +411,14 @@ pageClass: routes

#### 北京教育考试院

<Route author="gavin-k" example="/gov/beijing/bjeea/bjeeagg" path="/gov/beijing/bjeea/:type" :paramsDesc="['分类名']"/>
<Route author="gavin-k" example="/gov/beijing/bjeea/bjeeagg" path="/gov/beijing/bjeea/:type" :paramsDesc="['分类名']">

| 通知公告 | 招考政策 | 自考快递 |
| :------: | :------: | :------: |
| bjeeagg | zkzc | zkkd |

</Route>

### 河北省退役军人事务厅

<Route author="SunShinenny" example="/gov/veterans/hebei/sxxx" path="/gov/veterans/hebei/:type" :paramsDesc="['分类名']">
Expand Down Expand Up @@ -494,7 +496,7 @@ pageClass: routes

### 领事馆重要通知

<Route author="HenryQW" example="/embassy/us/chicago" path="/embassy/:country/:city" :paramsDesc="['国家短代码, 见[支持国家列表](#支持国家列表)', '城市, 对应国家列表下的`领事馆城市列表`']" />
<Route author="HenryQW" example="/embassy/us/chicago" path="/embassy/:country/:city" :paramsDesc="['国家短代码, 见[支持国家列表](#支持国家列表)', '城市, 对应国家列表下的`领事馆城市列表`']" >

### 支持国家列表

Expand Down Expand Up @@ -605,6 +607,8 @@ pageClass: routes
| 贝尔法斯特 | `/embassy/uk/belfast` |
| 曼彻斯特 | `/embassy/uk/manchester` |

</Route>

## 中华人民共和国国家发展和改革委员会

### 新闻动态
Expand Down
10 changes: 9 additions & 1 deletion docs/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,14 @@ type 为 all 时,category 参数不支持 cost 和 free
| ---- | ---- | ----- |
| yi | zhu | shang |

</Route>
Gem1ni marked this conversation as resolved.
Show resolved Hide resolved

## 骨朵数据

### 日榜

<Route author="Gem1ni" example="/guduodata/daily" path="/guduodata/daily" />

## 国家留学网

### 通知
Expand Down Expand Up @@ -1024,4 +1032,4 @@ type 为 all 时,category 参数不支持 cost 和 free
| ---- | ---- |
| ch | pt |

</Route>
</Route>
63 changes: 63 additions & 0 deletions lib/v2/guduodata/daily.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const got = require('@/utils/got');
const dayjs = require('dayjs');
const { art } = require('@/utils/render');
const path = require('path');

const host = 'http://data.guduodata.com';

const types = {
collect: {
name: '汇总榜',
categories: {
drama: '连续剧',
variety: '综艺'
}
},
bill: {
name: '排行榜',
categories: {
network_drama: '网络剧',
network_movie: '网络大电影',
network_variety: '网络综艺',
tv_drama: '电视剧',
tv_variety: '电视综艺',
anime: '国漫'
}
}
};

module.exports = async (ctx) => {
const now = dayjs().valueOf();
// yestoday
const yestoday = dayjs().subtract(1, 'day').format('YYYY-MM-DD');
const renderRows = (rows) => art(path.join(__dirname, './templates/daily.art'), { rows });
const items = Object.keys(types).flatMap((key) =>
Object.keys(types[key].categories).map((category) => ({
type: key,
name: `[${yestoday}] ${types[key].name} - ${types[key].categories[category]}`,
category: category.toUpperCase(),
url: `${host}/show/datalist?type=DAILY&category=${category.toUpperCase()}&date=${yestoday}`
}))
);
ctx.state.data = {
title: `骨朵数据 - 日榜`,
link: host,
description: yestoday,
item: await Promise.all(
items.map((item) => ctx.cache.tryGet(item.url,
async () => {
const response = await got.get(`${item.url}&t=${now}`, {
headers: { Referer: `http://data.guduodata.com/`, },
});
const data = response.data.data;
return {
title: item.name,
pubDate: yestoday,
link: item.url,
description: renderRows(data),
};
})
)
)
};
};
3 changes: 3 additions & 0 deletions lib/v2/guduodata/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/daily': ['Gem1ni'],
};
13 changes: 13 additions & 0 deletions lib/v2/guduodata/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'guduodata.com': {
_name: '骨朵数据',
data: [
{
title: '日榜',
docs: 'https://docs.rsshub.app/other.html#gu-duo-shu-ju',
source: ['/'],
target: '/daily',
Gem1ni marked this conversation as resolved.
Show resolved Hide resolved
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/guduodata/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/daily', require('./daily'));
};
26 changes: 26 additions & 0 deletions lib/v2/guduodata/templates/daily.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<table border="1" cellpadding="2" cellspacing="0">
<thead>
<th>排名</th>
<th>剧名</th>
<th>播放平台</th>
<th>上映时间</th>
<th>评论数</th>
<th>百度指数</th>
<th>豆瓣评分</th>
<th>全网热度</th>
</thead>
<tbody>
{{each rows}}
<tr>
<td>{{$index + 1}}</td>
<td>{{$value.name}}</td>
<td>{{$value.platforms}}</td>
<td>{{$value.release_date}}</td>
<td>{{$value.comment || ''}}</td>
<td>{{$value.baidu_index || ''}}</td>
<td>{{$value.douban || ''}}</td>
<td>{{$value.gdi}}</td>
</tr>
{{/each}}
</tbody>
</table>