0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00:00

[vk] Fix date and view count extraction.

This commit is contained in:
Kacper Michajłow 2016-09-25 20:26:58 +02:00 committed by Sergey M․
parent efa97bdcf1
commit 3aa3953d28
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D
2 changed files with 7 additions and 12 deletions

View file

@ -373,19 +373,12 @@ def _real_extract(self, url):
title = self._live_title(title) title = self._live_title(title)
# Extract upload date # Extract upload date
upload_date = None upload_date = unified_strdate(self._html_search_regex(
mobj = re.search(r'id="mv_date(?:_views)?_wrap"[^>]*>([a-zA-Z]+ [0-9]+), ([0-9]+) at', info_page) r'class="mv_info_date[^>]*>([^<]*)<', info_page, 'upload date', default=None))
if mobj is not None:
mobj.group(1) + ' ' + mobj.group(2)
upload_date = unified_strdate(mobj.group(1) + ' ' + mobj.group(2))
view_count = None view_count = str_to_int(self._html_search_regex(
views = self._html_search_regex( r'class="mv_views_count[^>]*>([\d,.]+)',
r'"mv_views_count_number"[^>]*>(.+?\bviews?)<', info_page, 'view count', default=None))
info_page, 'view count', default=None)
if views:
view_count = str_to_int(self._search_regex(
r'([\d,.]+)', views, 'view count', fatal=False))
formats = [] formats = []
for format_id, format_url in data.items(): for format_id, format_url in data.items():

View file

@ -124,6 +124,8 @@ def register_socks_protocols():
'%d %b %Y', '%d %b %Y',
'%B %d %Y', '%B %d %Y',
'%b %d %Y', '%b %d %Y',
'%b %d %Y at %H:%M',
'%b %d %Y at %H:%M:%S',
'%b %dst %Y %I:%M', '%b %dst %Y %I:%M',
'%b %dnd %Y %I:%M', '%b %dnd %Y %I:%M',
'%b %dth %Y %I:%M', '%b %dth %Y %I:%M',