1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-23 16:36:48 +00:00

[vk] Improve view count extraction

This commit is contained in:
Sergey M․ 2016-09-29 23:51:52 +07:00
parent a7ee8a00f4
commit 70d7b323b6
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -255,6 +255,7 @@ class VKIE(VKBaseIE):
'title': 'ИгроМир 2016 — день 1', 'title': 'ИгроМир 2016 — день 1',
'uploader': 'Игромания', 'uploader': 'Игромания',
'duration': 5239, 'duration': 5239,
'view_count': int,
}, },
}, },
{ {
@ -376,14 +377,13 @@ class VKIE(VKBaseIE):
if data.get('live') == 2: if data.get('live') == 2:
title = self._live_title(title) title = self._live_title(title)
# Extract upload date
timestamp = unified_timestamp(self._html_search_regex( 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)) 'upload date', fatal=False))
view_count = str_to_int(self._html_search_regex( view_count = str_to_int(self._search_regex(
r'class="mv_views_count[^>]*>([\d,.]+)', r'class=["\']mv_views_count[^>]+>\s*([\d,.]+)',
info_page, 'view count', default=None)) info_page, 'view count', fatal=False))
formats = [] formats = []
for format_id, format_url in data.items(): for format_id, format_url in data.items():