summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-07-09 03:27:11 +0700
committerSergey M․ <dstftw@gmail.com>2016-07-09 03:27:11 +0700
commit6b3a3098b53519ba8052ad0572e1d559947cfdd8 (patch)
treed966b152c44b2962d8ddd342be0d0873eeeeefa4
parent2de624fdd5b2d94bcf548633d6fe1897ccb7cf46 (diff)
downloadyoutube-dl-6b3a3098b53519ba8052ad0572e1d559947cfdd8.tar.gz
youtube-dl-6b3a3098b53519ba8052ad0572e1d559947cfdd8.tar.xz
youtube-dl-6b3a3098b53519ba8052ad0572e1d559947cfdd8.zip
[extractor/common] Extract more metadata for VideoObject in _json_ld
-rw-r--r--youtube_dl/extractor/common.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index 0cb5e5bb0..9ffe64d05 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -44,6 +44,7 @@ from ..utils import (
     sanitized_Request,
     unescapeHTML,
     unified_strdate,
+    unified_timestamp,
     url_basename,
     xpath_element,
     xpath_text,
@@ -840,10 +841,16 @@ class InfoExtractor(object):
                 })
             elif item_type == 'VideoObject':
                 info.update({
+                    'url': json_ld.get('contentUrl'),
                     'title': unescapeHTML(json_ld.get('name')),
                     'description': unescapeHTML(json_ld.get('description')),
-                    'upload_date': unified_strdate(json_ld.get('upload_date')),
-                    'url': unescapeHTML(json_ld.get('contentUrl')),
+                    'thumbnail': json_ld.get('thumbnailUrl'),
+                    'duration': parse_duration(json_ld.get('duration')),
+                    'timestamp': unified_timestamp(json_ld.get('uploadDate')),
+                    'filesize': float_or_none(json_ld.get('contentSize')),
+                    'tbr': int_or_none(json_ld.get('bitrate')),
+                    'width': int_or_none(json_ld.get('width')),
+                    'height': int_or_none(json_ld.get('height')),
                 })
         return dict((k, v) for k, v in info.items() if v is not None)