Unify coding cookie
[youtube-dl] / youtube_dl / extractor / vk.py
index 77f5cebcfb053823c61d3f1b578bb1e5e80af891..ac77bc6235c89d3b3b841948460718fee8aa4392 100644 (file)
@@ -1,4 +1,4 @@
-# encoding: utf-8
+# coding: utf-8
 from __future__ import unicode_literals
 
 import collections
@@ -255,6 +255,7 @@ class VKIE(VKBaseIE):
                 'title': 'ИгроМир 2016 — день 1',
                 'uploader': 'Игромания',
                 'duration': 5239,
+                'view_count': int,
             },
         },
         {
@@ -376,14 +377,13 @@ class VKIE(VKBaseIE):
         if data.get('live') == 2:
             title = self._live_title(title)
 
-        # Extract upload date
         timestamp = unified_timestamp(self._html_search_regex(
-            r'class=["\']mv_info_date[^>]*>([^<]+)(?:<|from)', info_page,
+            r'class=["\']mv_info_date[^>]+>([^<]+)(?:<|from)', info_page,
             'upload date', fatal=False))
 
-        view_count = str_to_int(self._html_search_regex(
-            r'class="mv_views_count[^>]*>([\d,.]+)',
-            info_page, 'view count', default=None))
+        view_count = str_to_int(self._search_regex(
+            r'class=["\']mv_views_count[^>]+>\s*([\d,.]+)',
+            info_page, 'view count', fatal=False))
 
         formats = []
         for format_id, format_url in data.items():