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>[^/#?"]+)
51 _EMBED_REGEX
= [rf
'(?x)<iframe[^>]+\bsrc=[\'"](?P<url>{_VALID_URL})']
53 'url': 'https://www.acast.com/sparpodcast/2.raggarmordet-rosterurdetforflutna',
55 'id': '2a92b283-1a75-4ad8-8396-499c641de0d9',
57 'title': '2. Raggarmordet - Röster ur det förflutna',
58 'description': 'md5:013959207e05011ad14a222cf22278cc',
59 'timestamp': 1477346700,
60 'upload_date': '20161024',
62 'creator': 'Third Ear Studio',
64 'episode': '2. Raggarmordet - Röster ur det förflutna',
65 'thumbnail': 'https://assets.pippa.io/shows/616ebe1886d7b1398620b943/616ebe33c7e6e70013cae7da.jpg',
67 'display_id': '2.raggarmordet-rosterurdetforflutna',
72 'url': 'http://embed.acast.com/adambuxton/ep.12-adam-joeschristmaspodcast2015',
73 'only_matching': True,
75 'url': 'https://play.acast.com/s/rattegangspodden/s04e09styckmordetihelenelund-del2-2',
76 'only_matching': True,
78 'url': 'https://play.acast.com/s/sparpodcast/2a92b283-1a75-4ad8-8396-499c641de0d9',
79 'only_matching': True,
82 'url': 'https://ausi.anu.edu.au/news/democracy-sausage-episode-can-labor-be-long-form-government',
84 'id': '646c68fb21fbf20011e9c651',
86 'creator': 'The Australian National University',
87 'display_id': 'can-labor-be-a-long-form-government',
89 'thumbnail': 'https://assets.pippa.io/shows/6113e8578b4903809f16f7e5/1684821529295-515b9520db9ce53275b995eb302f941c.jpeg',
90 'title': 'Can Labor be a long-form government?',
91 'episode': 'Can Labor be a long-form government?',
92 'upload_date': '20230523',
93 'series': 'Democracy Sausage with Mark Kenny',
94 'timestamp': 1684826362,
95 'description': 'md5:feabe1fc5004c78ee59c84a46bf4ba16',
99 def _real_extract(self
, url
):
100 channel
, display_id
= self
._match
_valid
_url
(url
).groups()
101 episode
= self
._call
_api
(
102 '%s/episodes/%s' % (channel
, display_id
),
103 display_id
, {'showInfo': 'true'})
104 return self
._extract
_episode
(
105 episode
, self
._extract
_show
_info
(episode
.get('show') or {}))
108 class ACastChannelIE(ACastBaseIE
):
109 IE_NAME
= 'acast:channel'
110 _VALID_URL
= r
'''(?x)
113 (?:www\.)?acast\.com/|
119 'url': 'https://www.acast.com/todayinfocus',
121 'id': '4efc5294-5385-4847-98bd-519799ce5786',
122 'title': 'Today in Focus',
123 'description': 'md5:c09ce28c91002ce4ffce71d6504abaae',
125 'playlist_mincount': 200,
127 'url': 'http://play.acast.com/s/ft-banking-weekly',
128 'only_matching': True,
132 def suitable(cls
, url
):
133 return False if ACastIE
.suitable(url
) else super(ACastChannelIE
, cls
).suitable(url
)
135 def _real_extract(self
, url
):
136 show_slug
= self
._match
_id
(url
)
137 show
= self
._call
_api
(show_slug
, show_slug
)
138 show_info
= self
._extract
_show
_info
(show
)
140 for episode
in (show
.get('episodes') or []):
141 entries
.append(self
._extract
_episode
(episode
, show_info
))
142 return self
.playlist_result(
143 entries
, show
.get('id'), show
.get('title'), show
.get('description'))