1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 23:07:16 +08:00

Raise error in case of paid videos.

This commit is contained in:
Avi Peretz 2019-01-16 12:31:43 +02:00
parent bfc8eeea57
commit 341cc7125b

View File

@ -115,7 +115,12 @@ class OdnoklassnikiIE(InfoExtractor):
}, { }, {
'url': 'https://m.ok.ru/dk?st.cmd=movieLayer&st.discId=863789452017&st.retLoc=friend&st.rtu=%2Fdk%3Fst.cmd%3DfriendMovies%26st.mode%3Down%26st.mrkId%3D%257B%2522uploadedMovieMarker%2522%253A%257B%2522marker%2522%253A%25221519410114503%2522%252C%2522hasMore%2522%253Atrue%257D%252C%2522sharedMovieMarker%2522%253A%257B%2522marker%2522%253Anull%252C%2522hasMore%2522%253Afalse%257D%257D%26st.friendId%3D561722190321%26st.frwd%3Don%26_prevCmd%3DfriendMovies%26tkn%3D7257&st.discType=MOVIE&st.mvId=863789452017&_prevCmd=friendMovies&tkn=3648#lst#', 'url': 'https://m.ok.ru/dk?st.cmd=movieLayer&st.discId=863789452017&st.retLoc=friend&st.rtu=%2Fdk%3Fst.cmd%3DfriendMovies%26st.mode%3Down%26st.mrkId%3D%257B%2522uploadedMovieMarker%2522%253A%257B%2522marker%2522%253A%25221519410114503%2522%252C%2522hasMore%2522%253Atrue%257D%252C%2522sharedMovieMarker%2522%253A%257B%2522marker%2522%253Anull%252C%2522hasMore%2522%253Afalse%257D%257D%26st.friendId%3D561722190321%26st.frwd%3Don%26_prevCmd%3DfriendMovies%26tkn%3D7257&st.discType=MOVIE&st.mvId=863789452017&_prevCmd=friendMovies&tkn=3648#lst#',
'only_matching': True, 'only_matching': True,
}] }, {
# Paid video
'url': 'https://ok.ru/video/954886983203',
'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(
@ -153,6 +158,10 @@ 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.