Feature/dev guduodata (#8502)

Co-authored-by: Tony <TonyRL@users.noreply.github.com>
This commit is contained in:
Huang Yinglun 2022-01-22 23:58:12 +08:00 committed by GitHub
parent bd500ce58b
commit 85caaa0dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 125 additions and 3 deletions

View File

@ -869,3 +869,5 @@ pageClass: routes
| 灵异事件 | 灵异图片 | 民间奇谈 |
| ------------- | ------------ | ------------ |
| lingyishijain | lingyitupian | minjianqitan |
</Route>

View File

@ -505,12 +505,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="['分类名']">
@ -588,7 +590,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="['国家短代码, 见[支持国家列表](#支持国家列表)', '城市, 对应国家列表下的`领事馆城市列表`']" >
### 支持国家列表
@ -699,6 +701,8 @@ pageClass: routes
| 贝尔法斯特 | `/embassy/uk/belfast` |
| 曼彻斯特 | `/embassy/uk/manchester` |
</Route>
## 中华人民共和国国家发展和改革委员会
### 新闻动态

View File

@ -411,6 +411,14 @@ type 为 all 时category 参数不支持 cost 和 free
| ---- | ---- | ----- |
| yi | zhu | shang |
</Route>
## 骨朵数据
### 日榜
<Route author="Gem1ni" example="/guduodata/daily" path="/guduodata/daily" />
## 光大银行
### 外汇牌价
@ -1054,4 +1062,4 @@ type 为 all 时category 参数不支持 cost 和 free
| ---- | ---- |
| ch | pt |
</Route>
</Route>

63
lib/v2/guduodata/daily.js Normal file
View File

@ -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),
};
})
)
)
};
};

View File

@ -0,0 +1,3 @@
module.exports = {
'/daily': ['Gem1ni'],
};

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

@ -0,0 +1,13 @@
module.exports = {
'guduodata.com': {
_name: '骨朵数据',
data: [
{
title: '日榜',
docs: 'https://docs.rsshub.app/other.html#gu-duo-shu-ju',
source: ['/'],
target: '/guduodata/daily',
},
],
},
};

View File

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

View File

@ -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>