mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
const id = ctx.params.id;
|
|
const hostname = 'https://scoresaber.com';
|
|
|
|
const response = await got({
|
|
method: 'get',
|
|
url: `${hostname}/u/${id}&sort=2`,
|
|
});
|
|
|
|
const $ = cheerio.load(response.data);
|
|
|
|
const username = $('.is-5 a').text();
|
|
const list = $('tbody tr').reverse();
|
|
|
|
const result1 = list
|
|
.map((index, item) => {
|
|
item = $(item);
|
|
const song = item.find('.songTop.pp').text();
|
|
const mapper = item.find('.songTop.mapper').text();
|
|
const rank = item.find('.rank').text();
|
|
const time = new Date(item.find('.time').attr('title')).toLocaleString();
|
|
const ppValue = item.find('.ppValue').text();
|
|
const ppWeightedValue = item.find('.ppWeightedValue').text();
|
|
const scoreBottom = item.find('.scoreBottom').text();
|
|
|
|
return {
|
|
title: `【${song}】${mapper} ${time} ${rank} PP:${ppValue}${ppWeightedValue} - ${scoreBottom}`,
|
|
description: $('.box:first-child').html(),
|
|
link: hostname + item.find('a').attr('href') + '?search=' + username,
|
|
pubDate: time,
|
|
author: 'scoresaber',
|
|
};
|
|
})
|
|
.get();
|
|
|
|
ctx.state.data = {
|
|
title: `${username}的ScoreSaber动态`,
|
|
link: `https://scoresaber.com/u/${id}&sort=2`,
|
|
item: result1,
|
|
};
|
|
};
|