mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 12:21:31 +08:00
feat(route): melon chart (#7318)
Co-authored-by: NeverBehave <gayhub@never.pet>
This commit is contained in:
@@ -66,6 +66,18 @@ Official RSS: https://eztv.io/ezrss.xml
|
|||||||
|
|
||||||
<RouteEn author="DCJaous" example="/javlibrary/bestreviews" path="/javlibrary/bestreviews" radar="1" rssbud="1"/>
|
<RouteEn author="DCJaous" example="/javlibrary/bestreviews" path="/javlibrary/bestreviews" radar="1" rssbud="1"/>
|
||||||
|
|
||||||
|
## Melon
|
||||||
|
|
||||||
|
### Chart
|
||||||
|
|
||||||
|
<RouteEn author="nczitzk" example="/melon/chart" path="/melon/chart/:category?" :paramsDesc="['Category, see below, 24H by default']">
|
||||||
|
|
||||||
|
| 24H | 일간 | 주간 | 월간 |
|
||||||
|
| - | - | - | - |
|
||||||
|
| | day | week | month |
|
||||||
|
|
||||||
|
</RouteEn>
|
||||||
|
|
||||||
## Nyaa
|
## Nyaa
|
||||||
|
|
||||||
### Seatch Result
|
### Seatch Result
|
||||||
|
|||||||
@@ -443,6 +443,18 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="hoilc" example="/lastfm/top/spain" path="/lastfm/top/:country?" :paramsDesc="['国家或地区, 需要符合`ISO 3166-1`的英文全称, 可参考`https://zh.wikipedia.org/wiki/ISO_3166-1二位字母代码#正式分配代码`']" radar="1" rssbud="1"/>
|
<Route author="hoilc" example="/lastfm/top/spain" path="/lastfm/top/:country?" :paramsDesc="['国家或地区, 需要符合`ISO 3166-1`的英文全称, 可参考`https://zh.wikipedia.org/wiki/ISO_3166-1二位字母代码#正式分配代码`']" radar="1" rssbud="1"/>
|
||||||
|
|
||||||
|
## Melon
|
||||||
|
|
||||||
|
### Chart
|
||||||
|
|
||||||
|
<Route author="nczitzk" example="/melon/chart" path="/melon/chart/:category?" :paramsDesc="['分类,见下表,默认为24H']">
|
||||||
|
|
||||||
|
| 24H | 일간 | 주간 | 월간 |
|
||||||
|
| --- | ---- | ---- | ----- |
|
||||||
|
| | day | week | month |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
## Mp4Ba
|
## Mp4Ba
|
||||||
|
|
||||||
### 影视分类
|
### 影视分类
|
||||||
|
|||||||
@@ -4071,6 +4071,9 @@ router.get('/jisilu/topic/:user', require('./routes/jisilu/topic'));
|
|||||||
// Constitutional Court of Baden-Württemberg (Germany)
|
// Constitutional Court of Baden-Württemberg (Germany)
|
||||||
router.get('/verfghbw/press/:keyword?', require('./routes/verfghbw/press'));
|
router.get('/verfghbw/press/:keyword?', require('./routes/verfghbw/press'));
|
||||||
|
|
||||||
|
// Melon
|
||||||
|
router.get('/melon/chart/:category?', require('./routes/melon/chart'));
|
||||||
|
|
||||||
// 弯弯字幕组
|
// 弯弯字幕组
|
||||||
router.get('/wanwansub/info/:id', require('./routes/wanwansub/info'));
|
router.get('/wanwansub/info/:id', require('./routes/wanwansub/info'));
|
||||||
router.get('/wanwansub/:id?', require('./routes/wanwansub/index'));
|
router.get('/wanwansub/:id?', require('./routes/wanwansub/index'));
|
||||||
|
|||||||
41
lib/routes/melon/chart.js
Normal file
41
lib/routes/melon/chart.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const category = ctx.params.category;
|
||||||
|
|
||||||
|
const rootUrl = 'https://www.melon.com';
|
||||||
|
const currentUrl = `${rootUrl}/chart/${category ? category + '/' : ''}index.htm`;
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: currentUrl,
|
||||||
|
});
|
||||||
|
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
|
const items = $('tr[data-song-no]')
|
||||||
|
.map((_, item) => {
|
||||||
|
item = $(item);
|
||||||
|
|
||||||
|
const image = item
|
||||||
|
.find('.image_typeAll img')
|
||||||
|
.attr('src')
|
||||||
|
.split(/\/melon\//)[0];
|
||||||
|
const title = item.find('.rank01').text();
|
||||||
|
const name = item.find('.rank02').text();
|
||||||
|
const album = item.find('.rank03').text();
|
||||||
|
|
||||||
|
return {
|
||||||
|
link: currentUrl,
|
||||||
|
title: item.find('.rank01').text(),
|
||||||
|
description: `<img src="${image}"><p>${title}</p><p>${name}</p><p>${album}</p>`,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get();
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: $('title').text(),
|
||||||
|
link: currentUrl,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user