diff options
author | LE <llacb47@users.noreply.github.com> | 2021-12-31 15:11:35 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-01 01:41:35 +0530 |
commit | 9040e2d6e3d1fc7ea7d49d3c872b3ec8f507050c (patch) | |
tree | a42d60a825b39a1036e05937c4da43b07a58c3e4 /yt_dlp/extractor/mixcloud.py | |
parent | 6134fbeb65dc0e574c0ae02924e2aac6b5b45752 (diff) | |
download | hypervideo-pre-9040e2d6e3d1fc7ea7d49d3c872b3ec8f507050c.tar.lz hypervideo-pre-9040e2d6e3d1fc7ea7d49d3c872b3ec8f507050c.tar.xz hypervideo-pre-9040e2d6e3d1fc7ea7d49d3c872b3ec8f507050c.zip |
[mixcloud] Detect restrictions (#2169)
Authored by; llacb47
Diffstat (limited to 'yt_dlp/extractor/mixcloud.py')
-rw-r--r-- | yt_dlp/extractor/mixcloud.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/yt_dlp/extractor/mixcloud.py b/yt_dlp/extractor/mixcloud.py index a0c043d4b..c2dd078ac 100644 --- a/yt_dlp/extractor/mixcloud.py +++ b/yt_dlp/extractor/mixcloud.py @@ -12,6 +12,7 @@ from ..compat import ( compat_zip ) from ..utils import ( + ExtractorError, int_or_none, parse_iso8601, strip_or_none, @@ -125,7 +126,20 @@ class MixcloudIE(MixcloudBaseIE): tag { name } - }''', track_id, username, slug) + } + restrictedReason + id''', track_id, username, slug) + + if not cloudcast: + raise ExtractorError('Track not found', expected=True) + + reason = cloudcast.get('restrictedReason') + if reason == 'tracklist': + raise ExtractorError('Track unavailable in your country due to licensing restrictions', expected=True) + elif reason == 'repeat_play': + raise ExtractorError('You have reached your play limit for this track', expected=True) + elif reason: + raise ExtractorError('Track is restricted', expected=True) title = cloudcast['name'] |