X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fvk.py;h=c30c5a8e524324a29d7c4a2dad49d5b9d50dda30;hb=e4df2f98ccbe2e24785dd6883d7fd495193fd8e6;hp=ef94b689488d98d7aec23c1d0afa9fe6544561c2;hpb=1ecb5d1d83970d6295c655a37c99e390fb5d7dee;p=youtube-dl diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py index ef94b6894..c30c5a8e5 100644 --- a/youtube_dl/extractor/vk.py +++ b/youtube_dl/extractor/vk.py @@ -154,6 +154,11 @@ class VKIE(InfoExtractor): 'url': 'http://vk.com/feed?z=video-43215063_166094326%2Fbb50cacd3177146d7a', 'only_matching': True, }, + { + # age restricted video, requires vk account credentials + 'url': 'https://vk.com/video205387401_164765225', + 'only_matching': True, + }, { # vk wrapper 'url': 'http://www.biqle.ru/watch/847655_160197695', @@ -205,6 +210,12 @@ class VKIE(InfoExtractor): info_page = self._download_webpage(info_url, video_id) + error_message = self._html_search_regex( + r'(?s)]+class="video_layer_message"[^>]*>(.+?)', + info_page, 'error message', default=None) + if error_message: + raise ExtractorError(error_message, expected=True) + if re.search(r'/login\.php\?.*\bact=security_check', info_page): raise ExtractorError( 'You are trying to log in from an unusual location. You should confirm ownership at vk.com to log in with this IP.', @@ -314,7 +325,7 @@ class VKUserVideosIE(InfoExtractor): entries = [ self.url_result( 'http://vk.com/video' + video_id, 'VK', video_id=video_id) - for video_id in set(re.findall(r'href="/video(-?[0-9_]+)"', webpage))] + for video_id in orderedSet(re.findall(r'href="/video(-?[0-9_]+)"', webpage))] title = unescapeHTML(self._search_regex( r'\s*([^<]+?)\s+\|\s+\d+\s+videos',