about summary refs log tree commit diff
path: root/youtube_dl/extractor/vk.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-07-13 21:52:52 +0700
committerSergey M․ <dstftw@gmail.com>2016-07-13 21:52:52 +0700
commit5f5a9d615835110380075343786e58f78f5b08a7 (patch)
treedddbb5e13e13804bd5981b992fda8d6ea0062a0f /youtube_dl/extractor/vk.py
parent2d19fb50725489d362d13e7347f90e0d2de10939 (diff)
downloadyoutube-dl-5f5a9d615835110380075343786e58f78f5b08a7.tar.gz
youtube-dl-5f5a9d615835110380075343786e58f78f5b08a7.tar.xz
youtube-dl-5f5a9d615835110380075343786e58f78f5b08a7.zip
[vk] Improve login
Diffstat (limited to 'youtube_dl/extractor/vk.py')
-rw-r--r--youtube_dl/extractor/vk.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py
index bcb7df83d..3ee66e23e 100644
--- a/youtube_dl/extractor/vk.py
+++ b/youtube_dl/extractor/vk.py
@@ -53,13 +53,14 @@ class VKBaseIE(InfoExtractor):
         # We will workaround this VK issue by resetting the remixlhk cookie to
         # the first one manually.
         cookies = url_handle.headers.get('Set-Cookie')
-        if sys.version_info[0] >= 3:
-            cookies = cookies.encode('iso-8859-1')
-        cookies = cookies.decode('utf-8')
-        remixlhk = re.search(r'remixlhk=(.+?);.*?\bdomain=(.+?)(?:[,;]|$)', cookies)
-        if remixlhk:
-            value, domain = remixlhk.groups()
-            self._set_cookie(domain, 'remixlhk', value)
+        if cookies:
+            if sys.version_info[0] >= 3:
+                cookies = cookies.encode('iso-8859-1')
+            cookies = cookies.decode('utf-8')
+            remixlhk = re.search(r'remixlhk=(.+?);.*?\bdomain=(.+?)(?:[,;]|$)', cookies)
+            if remixlhk:
+                value, domain = remixlhk.groups()
+                self._set_cookie(domain, 'remixlhk', value)
 
         login_page = self._download_webpage(
             'https://login.vk.com/?act=login', None,