1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 20:27:19 +08:00

Merge branch 'ok.ro-paid-videos' into fix.25.12.2018

This commit is contained in:
Avi Peretz 2019-01-20 11:10:01 +02:00
commit d65b9ef81b

View File

@ -119,8 +119,7 @@ class OdnoklassnikiIE(InfoExtractor):
# Paid video # Paid video
'url': 'https://ok.ru/video/954886983203', 'url': 'https://ok.ru/video/954886983203',
'only_matching': True, 'only_matching': True,
} }]
]
def _real_extract(self, url): def _real_extract(self, url):
start_time = int_or_none(compat_parse_qs( start_time = int_or_none(compat_parse_qs(
@ -158,10 +157,6 @@ class OdnoklassnikiIE(InfoExtractor):
video_id, 'Downloading metadata JSON', video_id, 'Downloading metadata JSON',
data=urlencode_postdata(data)) data=urlencode_postdata(data))
paymentInfo = metadata.get('paymentInfo')
if paymentInfo:
raise ExtractorError('This is Paid video. you need to subscribe in order to watch it', expected=True)
movie = metadata['movie'] movie = metadata['movie']
# Some embedded videos may not contain title in movie dict (e.g. # Some embedded videos may not contain title in movie dict (e.g.
@ -292,6 +287,11 @@ class OdnoklassnikiIE(InfoExtractor):
'ext': 'flv', 'ext': 'flv',
}) })
if not formats:
payment_info = metadata.get('paymentInfo')
if payment_info:
raise ExtractorError('This video is paid, subscribe to download it', expected=True)
self._sort_formats(formats) self._sort_formats(formats)
info['formats'] = formats info['formats'] = formats