X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fyoutube.py;h=cfe9eed551088dfac9d2690cac0de03c375c214e;hb=5c2266df4b9aeb7881ed8c026a038e2a25e43734;hp=bfa9a12a8fbd31d6158462ccac8fb327bb6481b1;hpb=9303ce3e6969b5818982d6214a8d0ff4e3c95286;p=youtube-dl diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index bfa9a12a8..cfe9eed55 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -20,12 +20,12 @@ from ..compat import ( compat_urllib_parse_unquote, compat_urllib_parse_unquote_plus, compat_urllib_parse_urlparse, - compat_urllib_request, compat_urlparse, compat_str, ) from ..utils import ( clean_html, + encode_dict, ExtractorError, float_or_none, get_element_by_attribute, @@ -33,6 +33,8 @@ from ..utils import ( int_or_none, orderedSet, parse_duration, + remove_start, + sanitized_Request, smuggle_url, str_to_int, unescapeHTML, @@ -110,12 +112,9 @@ class YoutubeBaseInfoExtractor(InfoExtractor): 'hl': 'en_US', } - # Convert to UTF-8 *before* urlencode because Python 2.x's urlencode - # chokes on unicode - login_form = dict((k.encode('utf-8'), v.encode('utf-8')) for k, v in login_form_strs.items()) - login_data = compat_urllib_parse.urlencode(login_form).encode('ascii') + login_data = compat_urllib_parse.urlencode(encode_dict(login_form_strs)).encode('ascii') - req = compat_urllib_request.Request(self._LOGIN_URL, login_data) + req = sanitized_Request(self._LOGIN_URL, login_data) login_results = self._download_webpage( req, None, note='Logging in', errnote='unable to log in', fatal=False) @@ -129,39 +128,26 @@ class YoutubeBaseInfoExtractor(InfoExtractor): # TODO add SMS and phone call support - these require making a request and then prompting the user if re.search(r'(?i)