]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/acast.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
14 class ACastBaseIE(InfoExtractor
):
15 def _extract_episode(self
, episode
, show_info
):
16 title
= episode
['title']
19 'display_id': episode
.get('episodeUrl'),
20 'url': clean_podcast_url(episode
['url']),
22 'description': clean_html(episode
.get('description') or episode
.get('summary')),
23 'thumbnail': episode
.get('image'),
24 'timestamp': parse_iso8601(episode
.get('publishDate')),
25 'duration': int_or_none(episode
.get('duration')),
26 'filesize': int_or_none(episode
.get('contentLength')),
27 'season_number': int_or_none(episode
.get('season')),
29 'episode_number': int_or_none(episode
.get('episode')),
31 info
.update(show_info
)
34 def _extract_show_info(self
, show
):
36 'creator': show
.get('author'),
37 'series': show
.get('title'),
40 def _call_api(self
, path
, video_id
, query
=None):
41 return self
._download
_json
(
42 'https://feeder.acast.com/api/v1/shows/' + path
, video_id
, query
=query
)
45 class ACastIE(ACastBaseIE
):
50 (?:(?:embed|www)\.)?acast\.com/|
53 (?P<channel>[^/]+)/(?P<id>[^/#?]+)
56 'url': 'https://www.acast.com/sparpodcast/2.raggarmordet-rosterurdetforflutna',
57 'md5': 'f5598f3ad1e4776fed12ec1407153e4b',
59 'id': '2a92b283-1a75-4ad8-8396-499c641de0d9',
61 'title': '2. Raggarmordet - Röster ur det förflutna',
62 'description': 'md5:a992ae67f4d98f1c0141598f7bebbf67',
63 'timestamp': 1477346700,
64 'upload_date': '20161024',
66 'creator': 'Anton Berg & Martin Johnson',
68 'episode': '2. Raggarmordet - Röster ur det förflutna',
71 'url': 'http://embed.acast.com/adambuxton/ep.12-adam-joeschristmaspodcast2015',
72 'only_matching': True,
74 'url': 'https://play.acast.com/s/rattegangspodden/s04e09styckmordetihelenelund-del2-2',
75 'only_matching': True,
77 'url': 'https://play.acast.com/s/sparpodcast/2a92b283-1a75-4ad8-8396-499c641de0d9',
78 'only_matching': True,
81 def _real_extract(self
, url
):
82 channel
, display_id
= self
._match
_valid
_url
(url
).groups()
83 episode
= self
._call
_api
(
84 '%s/episodes/%s' % (channel
, display_id
),
85 display_id
, {'showInfo': 'true'}
)
86 return self
._extract
_episode
(
87 episode
, self
._extract
_show
_info
(episode
.get('show') or {}))
90 class ACastChannelIE(ACastBaseIE
):
91 IE_NAME
= 'acast:channel'
95 (?:www\.)?acast\.com/|
101 'url': 'https://www.acast.com/todayinfocus',
103 'id': '4efc5294-5385-4847-98bd-519799ce5786',
104 'title': 'Today in Focus',
105 'description': 'md5:c09ce28c91002ce4ffce71d6504abaae',
107 'playlist_mincount': 200,
109 'url': 'http://play.acast.com/s/ft-banking-weekly',
110 'only_matching': True,
114 def suitable(cls
, url
):
115 return False if ACastIE
.suitable(url
) else super(ACastChannelIE
, cls
).suitable(url
)
117 def _real_extract(self
, url
):
118 show_slug
= self
._match
_id
(url
)
119 show
= self
._call
_api
(show_slug
, show_slug
)
120 show_info
= self
._extract
_show
_info
(show
)
122 for episode
in (show
.get('episodes') or []):
123 entries
.append(self
._extract
_episode
(episode
, show_info
))
124 return self
.playlist_result(
125 entries
, show
.get('id'), show
.get('title'), show
.get('description'))