mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
@@ -1,37 +1,25 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { JSDOM } = require('jsdom');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const team = ctx.params.team;
|
||||
const link = `https://www.dongqiudi.com/team/${team}.html`;
|
||||
|
||||
const response = await got.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
const teamName = $('h1.name').text();
|
||||
const list = $('table.schedule_list tr.stat_list');
|
||||
const out = [];
|
||||
const dom = new JSDOM(response.data, {
|
||||
runScripts: 'dangerously',
|
||||
});
|
||||
const data = dom.window.__NUXT__.data[0];
|
||||
const resultData = data.teamScheduleData.filter((data) => data.fs_A && data.fs_B);
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const $ = cheerio.load(list[i]);
|
||||
const teamName = data.teamDetail.base_info.team_name;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
const out = resultData.map((result) => ({
|
||||
title: `${result.match_title} ${result.team_A_name} ${result.fs_A}-${result.fs_B} ${result.team_B_name}`,
|
||||
guid: result.match_id,
|
||||
link: result.scheme.replace('dongqiudi:///game/', 'https://www.dongqiudi.com/liveDetail/'),
|
||||
pubDate: result.start_time,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${teamName} 比赛结果`,
|
||||
|
||||
Reference in New Issue
Block a user