aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/common.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-04-10 22:17:11 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-04-10 22:19:54 +0530
commitf7ad71607d0e733a602a9ae0493292b646d20fd4 (patch)
tree829639cad5d2f403fc59b40c79b936e53bfc3246 /yt_dlp/extractor/common.py
parent68379de561a3f7bc51cf82b983c77d25cd596123 (diff)
downloadhypervideo-pre-f7ad71607d0e733a602a9ae0493292b646d20fd4.tar.lz
hypervideo-pre-f7ad71607d0e733a602a9ae0493292b646d20fd4.tar.xz
hypervideo-pre-f7ad71607d0e733a602a9ae0493292b646d20fd4.zip
Update to ytdl-commit-4fb25ff
[maoritv] Add new extractor https://github.com/ytdl-org/youtube-dl/commit/4fb25ff5a3be5206bb72e5c4046715b1529fb2c7 Except: [vimeo] improve extraction https://github.com/ytdl-org/youtube-dl/commit/3ae9c0f410b1d4f63e8bada67dd62a8d2852be32 [youtube:tab] Pass innertube context... https://github.com/ytdl-org/youtube-dl/commit/1b0a13f33cfb3644cc718d35951ea85bb1905459
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r--yt_dlp/extractor/common.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index be3164ede..79f9c4035 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -17,7 +17,7 @@ import math
from ..compat import (
compat_cookiejar_Cookie,
- compat_cookies,
+ compat_cookies_SimpleCookie,
compat_etree_Element,
compat_etree_fromstring,
compat_getpass,
@@ -1308,6 +1308,7 @@ class InfoExtractor(object):
def extract_video_object(e):
assert e['@type'] == 'VideoObject'
+ author = e.get('author')
info.update({
'url': url_or_none(e.get('contentUrl')),
'title': unescapeHTML(e.get('name')),
@@ -1315,7 +1316,11 @@ class InfoExtractor(object):
'thumbnail': url_or_none(e.get('thumbnailUrl') or e.get('thumbnailURL')),
'duration': parse_duration(e.get('duration')),
'timestamp': unified_timestamp(e.get('uploadDate')),
- 'uploader': str_or_none(e.get('author')),
+ # author can be an instance of 'Organization' or 'Person' types.
+ # both types can have 'name' property(inherited from 'Thing' type). [1]
+ # however some websites are using 'Text' type instead.
+ # 1. https://schema.org/VideoObject
+ 'uploader': author.get('name') if isinstance(author, dict) else author if isinstance(author, compat_str) else None,
'filesize': float_or_none(e.get('contentSize')),
'tbr': int_or_none(e.get('bitrate')),
'width': int_or_none(e.get('width')),
@@ -3219,13 +3224,10 @@ class InfoExtractor(object):
self._downloader.cookiejar.set_cookie(cookie)
def _get_cookies(self, url):
- """ Return a compat_cookies.SimpleCookie with the cookies for the url """
+ """ Return a compat_cookies_SimpleCookie with the cookies for the url """
req = sanitized_Request(url)
self._downloader.cookiejar.add_cookie_header(req)
- cookie = req.get_header('Cookie')
- if cookie and sys.version_info[0] == 2:
- cookie = str(cookie)
- return compat_cookies.SimpleCookie(cookie)
+ return compat_cookies_SimpleCookie(req.get_header('Cookie'))
def _apply_first_set_cookie_header(self, url_handle, cookie):
"""