From 7280671596786fd053dc2b117e7f3328d176c991 Mon Sep 17 00:00:00 2001 From: Alex Snet Date: Sun, 29 Jun 2014 15:19:35 +0400 Subject: [PATCH 1/3] Update vk.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some videos have incorrect path in point of view of old regular expression. This just repair it, and all the videos detects good, I think. ``` ➜ ~ youtube-dl --verbose -g https://vk.com/\?z\=video-43215063_168067957%2F15c66b9b533119788d [debug] System config: [] [debug] User config: [] [debug] Command-line args: ['--verbose', '-g', 'https://vk.com/?z=video-43215063_168067957%2F15c66b9b533119788d'] [debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8 [debug] youtube-dl version 2014.06.26 [debug] Git HEAD: b1ce1ee [debug] Python version 2.7.6 - Darwin-13.2.0-x86_64-i386-64bit [debug] Proxy map: {} WARNING: Falling back on generic information extractor. ERROR: Unsupported URL: https://vk.com/?z=video-43215063_168067957%2F15c66b9b533119788d; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update. Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/generic.py", line 451, in _real_extract doc = parse_xml(webpage) File "/usr/local/lib/python2.7/site-packages/youtube_dl/utils.py", line 1406, in parse_xml return xml.etree.ElementTree.XML(s.encode('utf-8'), **kwargs) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML parser.feed(text) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1642, in feed self._raiseerror(v) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror raise err ParseError: mismatched tag: line 12, column 72 Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 516, in extract_info ie_result = ie.extract(url) File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/common.py", line 167, in extract return self._real_extract(url) File "/usr/local/lib/python2.7/site-packages/youtube_dl/extractor/generic.py", line 741, in _real_extract raise ExtractorError('Unsupported URL: %s' % url) ExtractorError: Unsupported URL: https://vk.com/?z=video-43215063_168067957%2F15c66b9b533119788d; please report this issue on https://yt-dl.org/bug . Be sure to call youtube-dl with the --verbose flag and include its complete output. Make sure you are using the latest version; type youtube-dl -U to update. ``` --- youtube_dl/extractor/vk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py index 66fe1dd3e..eba24310d 100644 --- a/youtube_dl/extractor/vk.py +++ b/youtube_dl/extractor/vk.py @@ -16,7 +16,7 @@ from ..utils import ( class VKIE(InfoExtractor): IE_NAME = 'vk.com' - _VALID_URL = r'https?://vk\.com/(?:video_ext\.php\?.*?\boid=(?P-?\d+).*?\bid=(?P\d+)|(?:videos.*?\?.*?z=)?video(?P.*?)(?:\?|%2F|$))' + _VALID_URL = r'https?://vk\.com/(?:video_ext\.php\?.*?\boid=(?P-?\d+).*?\bid=(?P\d+)|(?:[a-zA-Z0-9\.-_]+?z=)?video?-(?P[0-9_]+)(?:\?|%2F|$))' _NETRC_MACHINE = 'vk' _TESTS = [ From 330171adf075911c57ea92972529012d17bdd5fd Mon Sep 17 00:00:00 2001 From: Alex Snet Date: Sun, 29 Jun 2014 16:23:14 +0400 Subject: [PATCH 2/3] Update vk.py Second update to match URLs in test (but I think the are obsolete). --- youtube_dl/extractor/vk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py index eba24310d..50d352a4f 100644 --- a/youtube_dl/extractor/vk.py +++ b/youtube_dl/extractor/vk.py @@ -16,7 +16,7 @@ from ..utils import ( class VKIE(InfoExtractor): IE_NAME = 'vk.com' - _VALID_URL = r'https?://vk\.com/(?:video_ext\.php\?.*?\boid=(?P-?\d+).*?\bid=(?P\d+)|(?:[a-zA-Z0-9\.-_]+?z=)?video?-(?P[0-9_]+)(?:\?|%2F|$))' + _VALID_URL = r'https?://vk\.com/(?:video_ext\.php\?.*?\boid=(?P-?\d+).*?\bid=(?P\d+)|(?:.+?z=)?video-?)?(?P[0-9_]+)?(?:\?|%2F|$)?' _NETRC_MACHINE = 'vk' _TESTS = [ From d6a679f2036826344c1673a1796d6235a6e570ba Mon Sep 17 00:00:00 2001 From: Alex Snet Date: Sun, 29 Jun 2014 16:28:39 +0400 Subject: [PATCH 3/3] Update vk.py To handle mobile view of vk.com --- youtube_dl/extractor/vk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py index 50d352a4f..f42bf5f44 100644 --- a/youtube_dl/extractor/vk.py +++ b/youtube_dl/extractor/vk.py @@ -16,7 +16,7 @@ from ..utils import ( class VKIE(InfoExtractor): IE_NAME = 'vk.com' - _VALID_URL = r'https?://vk\.com/(?:video_ext\.php\?.*?\boid=(?P-?\d+).*?\bid=(?P\d+)|(?:.+?z=)?video-?)?(?P[0-9_]+)?(?:\?|%2F|$)?' + _VALID_URL = r'https?://(?Pm\.)?vk\.com/(?:video_ext\.php\?.*?\boid=(?P-?\d+).*?\bid=(?P\d+)|(?:.+?z=)?video-?)?(?P[0-9_]+)?(?:\?|%2F|$)?' _NETRC_MACHINE = 'vk' _TESTS = [