aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/vk.py
diff options
context:
space:
mode:
authorWill Sewell <me@willsewell.name>2014-11-18 20:19:56 +0000
committerWill Sewell <me@willsewell.name>2014-11-18 20:19:56 +0000
commit02a12f9fe69508525c9cad06782151f5cf950671 (patch)
treedc2577d84c3301e0bf746277c5639f259994b586 /youtube_dl/extractor/vk.py
parent6fcd6e0e21839ae4b1753995dc44d2a93f72ac1f (diff)
downloadyoutube-dl-02a12f9fe69508525c9cad06782151f5cf950671.tar.xz
[vk] date_added is now extracted from the video page.
Diffstat (limited to 'youtube_dl/extractor/vk.py')
-rw-r--r--youtube_dl/extractor/vk.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/youtube_dl/extractor/vk.py b/youtube_dl/extractor/vk.py
index 3bcf50e28..deaad6c3e 100644
--- a/youtube_dl/extractor/vk.py
+++ b/youtube_dl/extractor/vk.py
@@ -11,7 +11,7 @@ from ..utils import (
compat_urllib_parse,
compat_str,
unescapeHTML,
-)
+ unified_strdate)
class VKIE(InfoExtractor):
@@ -169,6 +169,12 @@ class VKIE(InfoExtractor):
data_json = self._search_regex(r'var vars = ({.*?});', info_page, 'vars')
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 = [{
'format_id': k,
'url': v,
@@ -183,7 +189,8 @@ class VKIE(InfoExtractor):
'title': unescapeHTML(data['md_title']),
'thumbnail': data.get('jpg'),
'uploader': data.get('md_author'),
- 'duration': data.get('duration')
+ 'duration': data.get('duration'),
+ 'upload_date': upload_date,
}