mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-30 15:39:07 +00:00
[deezer] Add support for geoblocking
This commit is contained in:
parent
4eefbfdbfd
commit
6539c91a78
@ -5,6 +5,7 @@ import re
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
orderedSet,
|
orderedSet,
|
||||||
)
|
)
|
||||||
@ -21,6 +22,7 @@ class DeezerPlaylistIE(InfoExtractor):
|
|||||||
'thumbnail': 're:^https?://cdn-images.deezer.com/images/cover/.*\.jpg$',
|
'thumbnail': 're:^https?://cdn-images.deezer.com/images/cover/.*\.jpg$',
|
||||||
},
|
},
|
||||||
'playlist_count': 30,
|
'playlist_count': 30,
|
||||||
|
'skip': 'Only available in .de',
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -31,6 +33,13 @@ class DeezerPlaylistIE(InfoExtractor):
|
|||||||
playlist_id = mobj.group('id')
|
playlist_id = mobj.group('id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, playlist_id)
|
webpage = self._download_webpage(url, playlist_id)
|
||||||
|
geoblocking_msg = self._html_search_regex(
|
||||||
|
r'<p class="soon-txt">(.*?)</p>', webpage, 'geoblocking message',
|
||||||
|
default=None)
|
||||||
|
if geoblocking_msg is not None:
|
||||||
|
raise ExtractorError(
|
||||||
|
'Deezer said: %s' % geoblocking_msg, expected=True)
|
||||||
|
|
||||||
data_json = self._search_regex(
|
data_json = self._search_regex(
|
||||||
r'naboo\.display\(\'[^\']+\',\s*(.*?)\);\n', webpage, 'data JSON')
|
r'naboo\.display\(\'[^\']+\',\s*(.*?)\);\n', webpage, 'data JSON')
|
||||||
data = json.loads(data_json)
|
data = json.loads(data_json)
|
||||||
|
Loading…
Reference in New Issue
Block a user