diff options
author | Sergey M․ <dstftw@gmail.com> | 2018-10-29 00:19:08 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2018-10-29 00:21:45 +0700 |
commit | bebef109092ba2ad1b08619661aa1b51e65be1bf (patch) | |
tree | 37d46911272f27cf925d1cd111837943f1447fa1 | |
parent | 4c237ab78768972e4d61d0b97fe9078d95dc4433 (diff) |
[extractor/common] Add validation for JSON-LD URLs
-rw-r--r-- | youtube_dl/extractor/common.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 2dbf81e6e..8452125c8 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -69,6 +69,7 @@ from ..utils import ( update_url_query, urljoin, url_basename, + url_or_none, xpath_element, xpath_text, xpath_with_ns, @@ -1213,10 +1214,10 @@ class InfoExtractor(object): def extract_video_object(e): assert e['@type'] == 'VideoObject' info.update({ - 'url': e.get('contentUrl'), + 'url': url_or_none(e.get('contentUrl')), 'title': unescapeHTML(e.get('name')), 'description': unescapeHTML(e.get('description')), - 'thumbnail': e.get('thumbnailUrl') or e.get('thumbnailURL'), + 'thumbnail': url_or_none(e.get('thumbnailUrl') or e.get('thumbnailURL')), 'duration': parse_duration(e.get('duration')), 'timestamp': unified_timestamp(e.get('uploadDate')), 'filesize': float_or_none(e.get('contentSize')), |