Add 懂球帝足球赛果 (#554)
This commit is contained in:
parent
bba9b064df
commit
c4e31a3dc4
|
|
@ -221,6 +221,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
- 讨论区
|
||||
- 懂球帝
|
||||
- 早报
|
||||
- 足球赛果
|
||||
- 维基百科
|
||||
- 中国大陆新闻动态
|
||||
- 雪球
|
||||
|
|
|
|||
|
|
@ -1835,6 +1835,16 @@ id, 专辑 id, 可在对应**专辑**页面的 URL 中找到
|
|||
|
||||
参数:无
|
||||
|
||||
### 足球赛果 <Author uid="HenryQW"/>
|
||||
|
||||
举例: 皇家马德里:[https://rsshub.app/dongqiudi/result/50001755](https://rsshub.app/dongqiudi/result/50001755)
|
||||
|
||||
路由: `/dongqiudi/result/:team`
|
||||
|
||||
参数:
|
||||
|
||||
team,球队 id,可在[懂球帝数据](https://www.dongqiudi.com/data)中找到
|
||||
|
||||
## 维基百科
|
||||
|
||||
### 中国大陆新闻动态 <Author uid="HenryQW"/>
|
||||
|
|
|
|||
|
|
@ -387,7 +387,8 @@ router.get('/namoc/exhibition', require('./routes/namoc/exhibition'));
|
|||
router.get('/namoc/specials', require('./routes/namoc/specials'));
|
||||
|
||||
// 懂球帝
|
||||
router.get('/dongqiudi/daily', require('./routes/dongqiudi/index'));
|
||||
router.get('/dongqiudi/daily', require('./routes/dongqiudi/daily'));
|
||||
router.get('/dongqiudi/result/:team', require('./routes/dongqiudi/result'));
|
||||
|
||||
// 维基百科
|
||||
router.get('/wikipedia/mainland', require('./routes/wikipedia/mainland'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const team = ctx.params.team;
|
||||
const link = `https://www.dongqiudi.com/team/${team}.html`;
|
||||
|
||||
const response = await axios.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const teamName = $('h1.name').text();
|
||||
const list = $('table.schedule_list tr.stat_list');
|
||||
const out = [];
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const $ = cheerio.load(list[i]);
|
||||
|
||||
const score = $('td:nth-of-type(5)')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
if (score !== '-') {
|
||||
const time = $('td.match_time_hidden').text();
|
||||
const type = $('td.gameweek').text();
|
||||
const home = $('td:nth-of-type(4)')
|
||||
.text()
|
||||
.trim();
|
||||
const away = $('td:nth-of-type(6)')
|
||||
.text()
|
||||
.trim();
|
||||
const title = `${type} ${home} ${score} ${away}`;
|
||||
|
||||
const single = {
|
||||
title,
|
||||
link,
|
||||
pubDate: new Date(time),
|
||||
guid: title,
|
||||
};
|
||||
out.push(single);
|
||||
}
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${teamName} 比赛结果`,
|
||||
link,
|
||||
item: out.slice(out.length - 10, out.length),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue