feat(route): add 增加小宇宙播客支持 (#9160)
* 增加小宇宙播客支持 * refactor: migrate to v2 Co-authored-by: maijver <maijver@gmail.com> Co-authored-by: maijver <cm1130335361@gmail.com>
This commit is contained in:
parent
75cb4f9e22
commit
050e72b67c
|
|
@ -1389,6 +1389,10 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
|
|||
|
||||
</Route>
|
||||
|
||||
### 播客
|
||||
|
||||
<Route author="hondajojo" example="/xiaoyuzhou/podcast/6021f949a789fca4eff4492c" path="/xiaoyuzhou/podcast/:id" :paramsDesc="['播客id,可以在小宇宙播客的 URL 中找到']"/>
|
||||
|
||||
## 优酷
|
||||
|
||||
### 频道
|
||||
|
|
|
|||
|
|
@ -3128,8 +3128,9 @@ router.get('/manxiaosi/book/:id', lazyloadRouteHandler('./routes/manxiaosi/book'
|
|||
// 吉林大学校内通知
|
||||
router.get('/jlu/oa', lazyloadRouteHandler('./routes/universities/jlu/oa'));
|
||||
|
||||
// 小宇宙
|
||||
router.get('/xiaoyuzhou', lazyloadRouteHandler('./routes/xiaoyuzhou/pickup'));
|
||||
// 小宇宙 migrated to v2
|
||||
// router.get('/xiaoyuzhou', lazyloadRouteHandler('./routes/xiaoyuzhou/pickup'));
|
||||
// router.get('/xiaoyuzhou/podcast/:id', lazyloadRouteHandler('./routes/xiaoyuzhou/podcast'));
|
||||
|
||||
// 合肥工业大学
|
||||
router.get('/hfut/tzgg', lazyloadRouteHandler('./routes/universities/hfut/tzgg'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'/': ['prnake', 'Maecenas'],
|
||||
'/podcast/:id': ['hondajojo'],
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = `https://www.xiaoyuzhoufm.com/podcast/${ctx.params.id}`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const page_data = JSON.parse($('#__NEXT_DATA__')[0].children[0].data);
|
||||
|
||||
const episodes = page_data.props.pageProps.podcast.episodes.map((item) => ({
|
||||
title: item.title,
|
||||
enclosure_url: item.enclosure.url,
|
||||
enclosure_length: item.duration,
|
||||
enclosure_type: 'audio/mpeg',
|
||||
link: `https://www.xiaoyuzhoufm.com/episode/${item.eid}`,
|
||||
pubDate: parseDate(item.pubDate),
|
||||
description: item.shownotes,
|
||||
itunes_item_image: item.image.smallPicUrl,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: page_data.props.pageProps.podcast.title,
|
||||
link: `https://www.xiaoyuzhoufm.com/podcast/${page_data.props.pageProps.podcast.pid}`,
|
||||
itunes_author: page_data.props.pageProps.podcast.author,
|
||||
itunes_category: '',
|
||||
image: page_data.props.pageProps.podcast.image.smallPicUrl,
|
||||
item: episodes,
|
||||
description: page_data.props.pageProps.podcast.description,
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
'xiaoyuzhoufm.com': {
|
||||
_name: '小宇宙',
|
||||
'.': [
|
||||
{
|
||||
title: '发现',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#xiao-yu-zhou',
|
||||
source: ['/'],
|
||||
target: '/xiaoyuzhou',
|
||||
},
|
||||
{
|
||||
title: '播客',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#xiao-yu-zhou',
|
||||
source: ['/podcast/:id'],
|
||||
target: '/xiaoyuzhou/podcast/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/podcast/:id', require('./podcast'));
|
||||
router.get('/', require('./pickup'));
|
||||
};
|
||||
Loading…
Reference in New Issue