X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fsmotri.py;h=24746a09a0c2183e8a0bd8e239cb59291b41f19a;hb=c6052b8c14db35258b5bb8fcb66b7216615083f5;hp=646af3cc9c9686b7d09fdc87b305c0b7c6c0f8ce;hpb=bf94e38d3d4aeb4edd5fc10ed9f4e905ee179913;p=youtube-dl diff --git a/youtube_dl/extractor/smotri.py b/youtube_dl/extractor/smotri.py index 646af3cc9..24746a09a 100644 --- a/youtube_dl/extractor/smotri.py +++ b/youtube_dl/extractor/smotri.py @@ -7,9 +7,11 @@ import hashlib import uuid from .common import InfoExtractor -from ..utils import ( +from ..compat import ( compat_urllib_parse, compat_urllib_request, +) +from ..utils import ( ExtractorError, int_or_none, unified_strdate, @@ -67,6 +69,7 @@ class SmotriIE(InfoExtractor): 'params': { 'videopassword': 'qwerty', }, + 'skip': 'Video is not approved by moderator', }, # age limit + video-password { @@ -84,12 +87,28 @@ class SmotriIE(InfoExtractor): }, 'params': { 'videopassword': '333' - } + }, + 'skip': 'Video is not approved by moderator', + }, + # not approved by moderator, but available + { + 'url': 'http://smotri.com/video/view/?id=v28888533b73', + 'md5': 'f44bc7adac90af518ef1ecf04893bb34', + 'info_dict': { + 'id': 'v28888533b73', + 'ext': 'mp4', + 'title': 'Russian Spies Killed By ISIL Child Soldier', + 'uploader': 'Mopeder', + 'uploader_id': 'mopeder', + 'duration': 71, + 'thumbnail': 'http://frame9.loadup.ru/d7/32/2888853.2.3.jpg', + 'upload_date': '20150114', + }, }, # swf player { 'url': 'http://pics.smotri.com/scrubber_custom8.swf?file=v9188090500', - 'md5': '4d47034979d9390d14acdf59c4935bc2', + 'md5': '31099eeb4bc906712c5f40092045108d', 'info_dict': { 'id': 'v9188090500', 'ext': 'mp4', @@ -120,9 +139,6 @@ class SmotriIE(InfoExtractor): def _search_meta(self, name, html, display_name=None): if display_name is None: display_name = name - return self._html_search_regex( - r'' % re.escape(name), - html, display_name, fatal=False) return self._html_search_meta(name, html, display_name) def _real_extract(self, url): @@ -142,13 +158,16 @@ class SmotriIE(InfoExtractor): video = self._download_json(request, video_id, 'Downloading video JSON') - if video.get('_moderate_no') or not video.get('moderated'): - raise ExtractorError('Video %s has not been approved by moderator' % video_id, expected=True) + video_url = video.get('_vidURL') or video.get('_vidURL_mp4') - if video.get('error'): - raise ExtractorError('Video %s does not exist' % video_id, expected=True) + if not video_url: + if video.get('_moderate_no') or not video.get('moderated'): + raise ExtractorError( + 'Video %s has not been approved by moderator' % video_id, expected=True) + + if video.get('error'): + raise ExtractorError('Video %s does not exist' % video_id, expected=True) - video_url = video.get('_vidURL') or video.get('_vidURL_mp4') title = video['title'] thumbnail = video['_imgURL'] upload_date = unified_strdate(video['added'])