diff options
author | Matthew <colethedj@protonmail.com> | 2021-04-03 21:50:58 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-03 14:20:58 +0530 |
commit | b28f8d244a3cb901eff5be438ad8f0508bd8e024 (patch) | |
tree | dad3e85d425d6b7f5fda895fec2223f6289eb494 | |
parent | 73cd218f5a0e73a21c81a7faef123c8d12e1da77 (diff) | |
download | hypervideo-pre-b28f8d244a3cb901eff5be438ad8f0508bd8e024.tar.lz hypervideo-pre-b28f8d244a3cb901eff5be438ad8f0508bd8e024.tar.xz hypervideo-pre-b28f8d244a3cb901eff5be438ad8f0508bd8e024.zip |
[YouTube] Show premium state in `availability` (#209)
Authored by colethedj
-rw-r--r-- | yt_dlp/extractor/youtube.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py index 794f51bb6..3e19d18a0 100644 --- a/yt_dlp/extractor/youtube.py +++ b/yt_dlp/extractor/youtube.py @@ -2296,8 +2296,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor): is_private = bool_or_none(video_details.get('isPrivate')) is_unlisted = bool_or_none(microformat.get('isUnlisted')) is_membersonly = None + is_premium = None if initial_data and is_private is not None: is_membersonly = False + is_premium = False contents = try_get(initial_data, lambda x: x['contents']['twoColumnWatchNextResults']['results']['results']['contents'], list) for content in contents or []: badges = try_get(content, lambda x: x['videoPrimaryInfoRenderer']['badges'], list) @@ -2306,13 +2308,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor): if label.lower() == 'members only': is_membersonly = True break - if is_membersonly: + elif label.lower() == 'premium': + is_premium = True + break + if is_membersonly or is_premium: break # TODO: Add this for playlists info['availability'] = self._availability( is_private=is_private, - needs_premium=False, # Youtube no longer have premium-only videos? + needs_premium=is_premium, needs_subscription=is_membersonly, needs_auth=info['age_limit'] >= 18, is_unlisted=None if is_private is None else is_unlisted) |