mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 21:23:05 +00:00
[ie/Spreaker] fix SpreakerPageIE URL detection
This commit is contained in:
parent
ae672525e7
commit
b10c245a82
@ -1938,7 +1938,6 @@ from .spotify import (
|
|||||||
SpotifyShowIE,
|
SpotifyShowIE,
|
||||||
)
|
)
|
||||||
from .spreaker import (
|
from .spreaker import (
|
||||||
SpreakerEpisodeIE,
|
|
||||||
SpreakerIE,
|
SpreakerIE,
|
||||||
SpreakerPageIE,
|
SpreakerPageIE,
|
||||||
SpreakerShowIE,
|
SpreakerShowIE,
|
||||||
|
@ -66,6 +66,7 @@ class SpreakerIE(InfoExtractor):
|
|||||||
v2/episodes
|
v2/episodes
|
||||||
)/
|
)/
|
||||||
(?P<id>\d+)
|
(?P<id>\d+)
|
||||||
|
(?:\?key=(?P<key>[^&]+))?
|
||||||
'''
|
'''
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://api.spreaker.com/episode/12534508',
|
'url': 'https://api.spreaker.com/episode/12534508',
|
||||||
@ -94,28 +95,33 @@ class SpreakerIE(InfoExtractor):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
episode_id = self._match_id(url)
|
episode_id, key = self._match_valid_url(url).group(
|
||||||
|
'id', 'key')
|
||||||
|
query = {}
|
||||||
|
if key is not None:
|
||||||
|
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)['response']['episode']
|
episode_id,
|
||||||
|
query=query)['response']['episode']
|
||||||
return _extract_episode(data, episode_id)
|
return _extract_episode(data, episode_id)
|
||||||
|
|
||||||
|
|
||||||
class SpreakerPageIE(InfoExtractor):
|
class SpreakerPageIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?spreaker\.com/user/[^/]+/(?P<id>[^/?#&]+)'
|
_VALID_URL = r'https?://(?:www\.)?spreaker\.com/episode/(?P<title>[^/?#]+)-(?P<id>\d+)(?:\?key=(?P<key>[^&]+))?'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.spreaker.com/user/9780658/swm-ep15-how-to-market-your-music-part-2',
|
'url': 'https://www.spreaker.com/episode/ep-15-music-marketing-likes-part-2--12534508',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
display_id = self._match_id(url)
|
episode_id, key = self._match_valid_url(url).group(
|
||||||
webpage = self._download_webpage(url, display_id)
|
'id', 'key')
|
||||||
episode_id = self._search_regex(
|
url = f'https://api.spreaker.com/episode/{episode_id}'
|
||||||
(r'data-episode_id=["\'](?P<id>\d+)',
|
if key is not None:
|
||||||
r'episode_id\s*:\s*(?P<id>\d+)'), webpage, 'episode id')
|
url = f'https://api.spreaker.com/episode/{episode_id}?key={key}'
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
f'https://api.spreaker.com/episode/{episode_id}',
|
url,
|
||||||
ie=SpreakerIE.ie_key(), video_id=episode_id)
|
ie=SpreakerIE.ie_key(), video_id=episode_id)
|
||||||
|
|
||||||
|
|
||||||
@ -170,23 +176,3 @@ class SpreakerShowPageIE(InfoExtractor):
|
|||||||
return self.url_result(
|
return self.url_result(
|
||||||
f'https://api.spreaker.com/show/{show_id}',
|
f'https://api.spreaker.com/show/{show_id}',
|
||||||
ie=SpreakerShowIE.ie_key(), video_id=show_id)
|
ie=SpreakerShowIE.ie_key(), video_id=show_id)
|
||||||
|
|
||||||
|
|
||||||
class SpreakerEpisodeIE(InfoExtractor):
|
|
||||||
_VALID_URL = r'https?://(?:www\.)?spreaker\.com/episode/(?P<title>[^/?#]+)-(?P<id>\d+)(?:\?key=(?P<key>[^&]+))?'
|
|
||||||
_TESTS = [{
|
|
||||||
'url': 'https://www.spreaker.com/episode/ep-15-music-marketing-likes-part-2--12534508',
|
|
||||||
'only_matching': True,
|
|
||||||
}]
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
episode_id, key = self._match_valid_url(url).group(
|
|
||||||
'id', 'key')
|
|
||||||
result = f'https://api.spreaker.com/episode/{episode_id}'
|
|
||||||
if key is not None:
|
|
||||||
access_key = f'?key={key}'
|
|
||||||
result = f'https://api.spreaker.com/episode/{episode_id}{access_key}'
|
|
||||||
data = self._download_json(
|
|
||||||
result,
|
|
||||||
episode_id)['response']['episode']
|
|
||||||
return _extract_episode(data, episode_id)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user