mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: podcast support for 60s science (#6056)
This commit is contained in:
@@ -6,9 +6,9 @@ pageClass: routes
|
||||
|
||||
## 60-Second Science - Scientific American
|
||||
|
||||
### Transcript
|
||||
<RouteEn author="emdoe" example="/60s-science" path="/60s-science"/>
|
||||
|
||||
<RouteEn author="emdoe" example="/60s-science/transcript" path="/60s-science/transcript"/>
|
||||
Full transcript support for better user experience.
|
||||
|
||||
## 99% Invisible
|
||||
|
||||
|
||||
+2
-2
@@ -12,9 +12,9 @@ pageClass: routes
|
||||
|
||||
## 60-Second Science - Scientific American
|
||||
|
||||
### Transcript
|
||||
<Route author="emdoe" example="/60s-science" path="/60s-science"/>
|
||||
|
||||
<Route author="emdoe" example="/60s-science/transcript" path="/60s-science/transcript"/>
|
||||
输出 Transcript 从而提供比官方(podcast)更好的使用体验。
|
||||
|
||||
## 99% Invisible
|
||||
|
||||
|
||||
+1
-1
@@ -985,7 +985,7 @@ router.get('/laosiji/feed', require('./routes/laosiji/feed'));
|
||||
router.get('/laosiji/hotshow/:id', require('./routes/laosiji/hotshow'));
|
||||
|
||||
// Scientific American 60-Second Science
|
||||
router.get('/60s-science/transcript', require('./routes/60s-science/transcript'));
|
||||
router.get('/60s-science', require('./routes/60s-science/transcript'));
|
||||
|
||||
// 99% Invisible
|
||||
router.get('/99percentinvisible/transcript', require('./routes/99percentinvisible/transcript'));
|
||||
|
||||
@@ -3,6 +3,7 @@ const got = require('@/utils/got');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://www.scientificamerican.com/podcast/60-second-science/`;
|
||||
const cover = `https://static.scientificamerican.com/sciam/cache/file/484FA146-8892-477F-B38D18775563CC9E_small.jpg`;
|
||||
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
@@ -28,10 +29,17 @@ module.exports = async (ctx) => {
|
||||
|
||||
capture('.transcript__close').remove();
|
||||
const intro = capture('.article-media__object').html() + '<br><br>';
|
||||
const contents = intro + capture('.transcript__inner').html();
|
||||
const contents =
|
||||
intro +
|
||||
capture('.transcript__inner')
|
||||
.html()
|
||||
.replace(/<p>\[?<em>\(?The above text.*this podcast.*?em.*?p>/g, '');
|
||||
const track = capture('.podcasts__media > div > a').attr('href');
|
||||
const single = {
|
||||
title,
|
||||
description: contents,
|
||||
enclosure_url: track,
|
||||
enclosure_type: 'audio/mpeg',
|
||||
link: address,
|
||||
guid: address,
|
||||
author: author,
|
||||
@@ -42,7 +50,10 @@ module.exports = async (ctx) => {
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: 'Transcripts of SA 60-Second Science',
|
||||
itunes_author: 'Scientific American',
|
||||
itunes_category: 'Science',
|
||||
image: cover,
|
||||
title: '60-Second Science',
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user