mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-28 15:46:54 +01:00
[mixcloud] Capture error message (#9156)
This commit is contained in:
parent
4a903b93a9
commit
49f523ca50
@ -7,6 +7,7 @@
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
HEADRequest,
|
||||
NO_DEFAULT,
|
||||
parse_count,
|
||||
str_to_int,
|
||||
)
|
||||
@ -63,8 +64,17 @@ def _real_extract(self, url):
|
||||
|
||||
webpage = self._download_webpage(url, track_id)
|
||||
|
||||
message = self._html_search_regex(
|
||||
r'(?s)<div[^>]+class="global-message cloudcast-disabled-notice-light"[^>]*>(.+?)<(?:a|/div)',
|
||||
webpage, 'error message', default=None)
|
||||
|
||||
preview_url = self._search_regex(
|
||||
r'\s(?:data-preview-url|m-preview)="([^"]+)"', webpage, 'preview url')
|
||||
r'\s(?:data-preview-url|m-preview)="([^"]+)"',
|
||||
webpage, 'preview url', default=None if message else NO_DEFAULT)
|
||||
|
||||
if message:
|
||||
raise ExtractorError('%s said: %s' % (self.IE_NAME, message), expected=True)
|
||||
|
||||
song_url = re.sub(r'audiocdn(\d+)', r'stream\1', preview_url)
|
||||
song_url = song_url.replace('/previews/', '/c/originals/')
|
||||
if not self._check_url(song_url, track_id, 'mp3'):
|
||||
|
Loading…
Reference in New Issue
Block a user