Compare commits

..

No commits in common. "8cf756477ba04a0a587b4914c27fe65b5adcdafd" and "b6059b8b9c0a74c44006c1671514a1b445d718fd" have entirely different histories.

View File

@ -61,7 +61,15 @@ def _extract_episode(data, episode_id=None):
class SpreakerIE(InfoExtractor): class SpreakerIE(InfoExtractor):
_VALID_URL = [ _VALID_URL = [
r'https?://api\.spreaker\.com/(?:(?:download/)?episode|v2/episodes)/(?P<id>\d+)', r'''(?x)
https?://
api\.spreaker\.com/
(?:
(?:download/)?episode|
v2/episodes
)/
(?P<id>\d+)
''',
r'https?://(?:www\.)?spreaker\.com/episode/[^#?/]*?(?P<id>\d+)/?(?:[?#]|$)', r'https?://(?:www\.)?spreaker\.com/episode/[^#?/]*?(?P<id>\d+)/?(?:[?#]|$)',
] ]
_TESTS = [{ _TESTS = [{
@ -80,9 +88,7 @@ class SpreakerIE(InfoExtractor):
'view_count': int, 'view_count': int,
'like_count': int, 'like_count': int,
'comment_count': int, 'comment_count': int,
'series': 'Success With Music | SWM', 'series': 'Success With Music (SWM)',
'thumbnail': 'https://d3wo5wojvuv7l.cloudfront.net/t_square_limited_160/images.spreaker.com/original/777ce4f96b71b0e1b7c09a5e625210e3.jpg',
'creators': ['SWM'],
}, },
}, { }, {
'url': 'https://api.spreaker.com/download/episode/12534508/swm_ep15_how_to_market_your_music_part_2.mp3', 'url': 'https://api.spreaker.com/download/episode/12534508/swm_ep15_how_to_market_your_music_part_2.mp3',
@ -100,27 +106,25 @@ class SpreakerIE(InfoExtractor):
'title': 'Grunge Music Origins - The Raw Sound that Defined a Generation', 'title': 'Grunge Music Origins - The Raw Sound that Defined a Generation',
'description': str, 'description': str,
'timestamp': 1717468905, 'timestamp': 1717468905,
'upload_date': '20240604', 'upload_date': '20170809',
'uploader': 'Katie Brown 2', 'uploader': 'Katie Brown 2',
'uploader_id': '17733249', 'uploader_id': '17733249',
'duration': 818.83, 'duration': 1063.42,
'view_count': int, 'view_count': int,
'like_count': int, 'like_count': int,
'comment_count': int, 'comment_count': int,
'series': '90s Grunge', 'series': '90s Grunge',
'thumbnail': 'https://d3wo5wojvuv7l.cloudfront.net/t_square_limited_160/images.spreaker.com/original/bb0d4178f7cf57cc8786dedbd9c5d969.jpg',
'creators': ['Katie Brown 2'],
}, },
}, {
'url': 'https://www.spreaker.com/episode/60269615',
'only_matching': True,
}] }]
def _real_extract(self, url): def _real_extract(self, url):
episode_id = self._match_id(url) episode_id = self._match_id(url)
query = {}
if key := traverse_obj(url, ({parse_qs}, 'key', 0)):
query = {'key': key}
data = self._download_json( data = self._download_json(
f'https://api.spreaker.com/v2/episodes/{episode_id}', f'https://api.spreaker.com/v2/episodes/{episode_id}',
episode_id, query=traverse_obj(parse_qs(url), {'key': ('key', 0)}))['response']['episode'] episode_id, query=query)['response']['episode']
return _extract_episode(data, episode_id) return _extract_episode(data, episode_id)