1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-25 17:27:36 +00:00

[vk] date_added is now extracted from the video page.

This commit is contained in:
Will Sewell 2014-11-18 20:19:56 +00:00
parent 6fcd6e0e21
commit 02a12f9fe6

View file

@ -11,7 +11,7 @@ from ..utils import (
compat_urllib_parse, compat_urllib_parse,
compat_str, compat_str,
unescapeHTML, unescapeHTML,
) unified_strdate)
class VKIE(InfoExtractor): class VKIE(InfoExtractor):
@ -169,6 +169,12 @@ class VKIE(InfoExtractor):
data_json = self._search_regex(r'var vars = ({.*?});', info_page, 'vars') data_json = self._search_regex(r'var vars = ({.*?});', info_page, 'vars')
data = json.loads(data_json) data = json.loads(data_json)
# Extract upload date
upload_date = None
mobj = re.search(r'id="mv_date_wrap".*?Added ([a-zA-Z]+ [0-9]+), ([0-9]+) at', info_page)
if mobj is not None:
upload_date = unified_strdate(mobj.group(1) + ' ' + mobj.group(2))
formats = [{ formats = [{
'format_id': k, 'format_id': k,
'url': v, 'url': v,
@ -183,7 +189,8 @@ class VKIE(InfoExtractor):
'title': unescapeHTML(data['md_title']), 'title': unescapeHTML(data['md_title']),
'thumbnail': data.get('jpg'), 'thumbnail': data.get('jpg'),
'uploader': data.get('md_author'), 'uploader': data.get('md_author'),
'duration': data.get('duration') 'duration': data.get('duration'),
'upload_date': upload_date,
} }