]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/acast.py
1 from .common
import InfoExtractor
10 class ACastBaseIE(InfoExtractor
):
11 def _extract_episode(self
, episode
, show_info
):
12 title
= episode
['title']
15 'display_id': episode
.get('episodeUrl'),
16 'url': clean_podcast_url(episode
['url']),
18 'description': clean_html(episode
.get('description') or episode
.get('summary')),
19 'thumbnail': episode
.get('image'),
20 'timestamp': parse_iso8601(episode
.get('publishDate')),
21 'duration': int_or_none(episode
.get('duration')),
22 'filesize': int_or_none(episode
.get('contentLength')),
23 'season_number': int_or_none(episode
.get('season')),
25 'episode_number': int_or_none(episode
.get('episode')),
27 info
.update(show_info
)
30 def _extract_show_info(self
, show
):
32 'creator': show
.get('author'),
33 'series': show
.get('title'),
36 def _call_api(self
, path
, video_id
, query
=None):
37 return self
._download
_json
(
38 'https://feeder.acast.com/api/v1/shows/' + path
, video_id
, query
=query
)
41 class ACastIE(ACastBaseIE
):
46 (?:(?:embed|www)\.)?acast\.com/|
49 (?P<channel>[^/]+)/(?P<id>[^/#?]+)
52 'url': 'https://www.acast.com/sparpodcast/2.raggarmordet-rosterurdetforflutna',
53 'md5': 'f5598f3ad1e4776fed12ec1407153e4b',
55 'id': '2a92b283-1a75-4ad8-8396-499c641de0d9',
57 'title': '2. Raggarmordet - Röster ur det förflutna',
58 'description': 'md5:a992ae67f4d98f1c0141598f7bebbf67',
59 'timestamp': 1477346700,
60 'upload_date': '20161024',
62 'creator': 'Anton Berg & Martin Johnson',
64 'episode': '2. Raggarmordet - Röster ur det förflutna',
67 'url': 'http://embed.acast.com/adambuxton/ep.12-adam-joeschristmaspodcast2015',
68 'only_matching': True,
70 'url': 'https://play.acast.com/s/rattegangspodden/s04e09styckmordetihelenelund-del2-2',
71 'only_matching': True,
73 'url': 'https://play.acast.com/s/sparpodcast/2a92b283-1a75-4ad8-8396-499c641de0d9',
74 'only_matching': True,
77 def _real_extract(self
, url
):
78 channel
, display_id
= self
._match
_valid
_url
(url
).groups()
79 episode
= self
._call
_api
(
80 '%s/episodes/%s' % (channel
, display_id
),
81 display_id
, {'showInfo': 'true'}
)
82 return self
._extract
_episode
(
83 episode
, self
._extract
_show
_info
(episode
.get('show') or {}))
86 class ACastChannelIE(ACastBaseIE
):
87 IE_NAME
= 'acast:channel'
91 (?:www\.)?acast\.com/|
97 'url': 'https://www.acast.com/todayinfocus',
99 'id': '4efc5294-5385-4847-98bd-519799ce5786',
100 'title': 'Today in Focus',
101 'description': 'md5:c09ce28c91002ce4ffce71d6504abaae',
103 'playlist_mincount': 200,
105 'url': 'http://play.acast.com/s/ft-banking-weekly',
106 'only_matching': True,
110 def suitable(cls
, url
):
111 return False if ACastIE
.suitable(url
) else super(ACastChannelIE
, cls
).suitable(url
)
113 def _real_extract(self
, url
):
114 show_slug
= self
._match
_id
(url
)
115 show
= self
._call
_api
(show_slug
, show_slug
)
116 show_info
= self
._extract
_show
_info
(show
)
118 for episode
in (show
.get('episodes') or []):
119 entries
.append(self
._extract
_episode
(episode
, show_info
))
120 return self
.playlist_result(
121 entries
, show
.get('id'), show
.get('title'), show
.get('description'))