Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mixcloud] add restriction detection #2169

Merged
merged 3 commits into from
Dec 31, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion yt_dlp/extractor/mixcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
compat_zip
)
from ..utils import (
ExtractorError,
int_or_none,
parse_iso8601,
strip_or_none,
Expand Down Expand Up @@ -125,7 +126,22 @@ def _real_extract(self, url):
tag {
name
}
}''', track_id, username, slug)
}
restrictedReason
id''', track_id, username, slug)

if not cloudcast:
raise ExtractorError('Track not found', expected=True)

if cloudcast['restrictedReason']:
reason = cloudcast['restrictedReason']
if reason == "tracklist":
raise ExtractorError('Track unavailable in your country due to licensing restrictions', expected=True)
elif reason == "repeat_play":
# https://help.mixcloud.com/hc/en-us/articles/360010592220-Why-can-I-only-replay-a-show-three-times-
raise ExtractorError('You have reached your play limit for this track', expected=True)
else:
raise ExtractorError('Track is restricted', expected=True)
liamengland1 marked this conversation as resolved.
Show resolved Hide resolved

title = cloudcast['name']

Expand Down