mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
@@ -197,3 +197,7 @@
|
|||||||
| 全部 | 蓝光 | 1080P | 720P | 3D | WEB-DL |
|
| 全部 | 蓝光 | 1080P | 720P | 3D | WEB-DL |
|
||||||
| ---- | ------ | ----- | ---- | --- | ------ |
|
| ---- | ------ | ----- | ---- | --- | ------ |
|
||||||
| 留空 | bluray | 1080p | 720p | 3d | webdl |
|
| 留空 | bluray | 1080p | 720p | 3d | webdl |
|
||||||
|
|
||||||
|
## SoundCloud
|
||||||
|
|
||||||
|
<Route name="Tracks" author="fallenhh" example="/soundcloud/tracks/angeart" path="/soundcloud/tracks/:user" :paramsDesc="['用户名']" />
|
||||||
|
|||||||
@@ -1328,6 +1328,9 @@ router.get('/asahichinese-f/:category', require('./routes/asahichinese-f/index')
|
|||||||
// 7x24小时快讯
|
// 7x24小时快讯
|
||||||
router.get('/fx678/kx', require('./routes/fx678/kx'));
|
router.get('/fx678/kx', require('./routes/fx678/kx'));
|
||||||
|
|
||||||
|
// SoundCloud
|
||||||
|
router.get('/soundcloud/tracks/:user', require('./routes/soundcloud/tracks'));
|
||||||
|
|
||||||
// dilidili
|
// dilidili
|
||||||
router.get('/dilidili/fanju/:id', require('./routes/dilidili/fanju'));
|
router.get('/dilidili/fanju/:id', require('./routes/dilidili/fanju'));
|
||||||
|
|
||||||
|
|||||||
28
lib/routes/soundcloud/tracks.js
Normal file
28
lib/routes/soundcloud/tracks.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const util = require('./utils');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const user = ctx.params.user;
|
||||||
|
|
||||||
|
const response = await axios({
|
||||||
|
method: 'get',
|
||||||
|
url: `https://soundcloud.com/${user}/tracks`,
|
||||||
|
headers: {
|
||||||
|
Referer: `https://soundcloud.com/${user}/tracks`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const data = response.data;
|
||||||
|
|
||||||
|
const $ = cheerio.load(data, { xmlMode: true });
|
||||||
|
const list = $('body article.audible').get();
|
||||||
|
const result = await util.ProcessFeed(list, ctx.cache);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: $('title').text(),
|
||||||
|
link: `https://soundcloud.com/${user}/tracks`,
|
||||||
|
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||||
|
item: result,
|
||||||
|
};
|
||||||
|
};
|
||||||
56
lib/routes/soundcloud/utils.js
Normal file
56
lib/routes/soundcloud/utils.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
const axios = require('../../utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const url = require('url');
|
||||||
|
|
||||||
|
async function load(link) {
|
||||||
|
const response = await axios.get(link);
|
||||||
|
const $ = cheerio.load(response.data, { xmlMode: true });
|
||||||
|
let result = '';
|
||||||
|
const tmp = $('noscript article p');
|
||||||
|
result += `<p>${tmp.html()}</p>`;
|
||||||
|
const embed_url = $('noscript article div')
|
||||||
|
.first()
|
||||||
|
.children()
|
||||||
|
.first()
|
||||||
|
.attr('content');
|
||||||
|
result += `<iframe width=85% src=${embed_url}/>`;
|
||||||
|
return { description: result };
|
||||||
|
}
|
||||||
|
|
||||||
|
const ProcessFeed = async (list, caches) => {
|
||||||
|
const host = 'https://www.soundcloud.com';
|
||||||
|
|
||||||
|
return await Promise.all(
|
||||||
|
list.map(async (item) => {
|
||||||
|
const $ = cheerio.load(item);
|
||||||
|
|
||||||
|
const $title = $('h2')
|
||||||
|
.children()
|
||||||
|
.first();
|
||||||
|
|
||||||
|
const itemUrl = url.resolve(host, $title.attr('href'));
|
||||||
|
|
||||||
|
const author = $('h2')
|
||||||
|
.children()
|
||||||
|
.last()
|
||||||
|
.text();
|
||||||
|
|
||||||
|
const date = new Date($('time').text());
|
||||||
|
const timeZone = 8;
|
||||||
|
const serverOffset = date.getTimezoneOffset() / 60;
|
||||||
|
const pubDate = new Date(date.getTime() - 60 * 60 * 1000 * (timeZone + serverOffset)).toUTCString();
|
||||||
|
const single = {
|
||||||
|
title: $title.text(),
|
||||||
|
link: itemUrl,
|
||||||
|
guid: itemUrl,
|
||||||
|
author,
|
||||||
|
pubDate,
|
||||||
|
};
|
||||||
|
const other = await caches.tryGet(itemUrl, async () => await load(itemUrl));
|
||||||
|
return Promise.resolve(Object.assign({}, single, other));
|
||||||
|
})
|
||||||
|
);
|
||||||
|
};
|
||||||
|
module.exports = {
|
||||||
|
ProcessFeed,
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user