@ -17,16 +17,15 @@ from ..swfinterp import SWFInterpreter
from . . compat import (
compat_chr ,
compat_parse_qs ,
compat_urllib_parse ,
compat_urllib_parse_unquote ,
compat_urllib_parse_unquote_plus ,
compat_urllib_parse_urlencode ,
compat_urllib_parse_urlparse ,
compat_urlparse ,
compat_str ,
)
from . . utils import (
clean_html ,
encode_dict ,
error_to_compat_str ,
ExtractorError ,
float_or_none ,
@ -116,7 +115,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
' hl ' : ' en_US ' ,
}
login_data = compat_urllib_parse . urlencode ( encode_dict ( login_form_strs ) ) . encode ( ' ascii ' )
login_data = compat_urllib_parse _urlencode( login_form_strs ) . encode ( ' ascii ' )
req = sanitized_Request ( self . _LOGIN_URL , login_data )
login_results = self . _download_webpage (
@ -149,7 +148,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
' TrustDevice ' : ' on ' ,
} )
tfa_data = compat_urllib_parse . urlencode ( encode_dict ( tfa_form_strs ) ) . encode ( ' ascii ' )
tfa_data = compat_urllib_parse _urlencode( tfa_form_strs ) . encode ( ' ascii ' )
tfa_req = sanitized_Request ( self . _TWOFACTOR_URL , tfa_data )
tfa_results = self . _download_webpage (
@ -1007,7 +1006,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
continue
sub_formats = [ ]
for ext in self . _SUBTITLE_FORMATS :
params = compat_urllib_parse . urlencode( {
params = compat_urllib_parse _ urlencode( {
' lang ' : lang ,
' v ' : video_id ,
' fmt ' : ext ,
@ -1056,7 +1055,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
if caption_url :
timestamp = args [ ' timestamp ' ]
# We get the available subtitles
list_params = compat_urllib_parse . urlencode( {
list_params = compat_urllib_parse _ urlencode( {
' type ' : ' list ' ,
' tlangs ' : 1 ,
' asrs ' : 1 ,
@ -1075,7 +1074,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
sub_lang = lang_node . attrib [ ' lang_code ' ]
sub_formats = [ ]
for ext in self . _SUBTITLE_FORMATS :
params = compat_urllib_parse . urlencode( {
params = compat_urllib_parse _ urlencode( {
' lang ' : original_lang ,
' tlang ' : sub_lang ,
' fmt ' : ext ,
@ -1094,7 +1093,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
caption_tracks = args [ ' caption_tracks ' ]
caption_translation_languages = args [ ' caption_translation_languages ' ]
caption_url = compat_parse_qs ( caption_tracks . split ( ' , ' ) [ 0 ] ) [ ' u ' ] [ 0 ]
parsed_caption_url = compat_url parse. urlparse( caption_url )
parsed_caption_url = compat_url lib_parse_ urlparse( caption_url )
caption_qs = compat_parse_qs ( parsed_caption_url . query )
sub_lang_list = { }
@ -1110,7 +1109,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
' fmt ' : [ ext ] ,
} )
sub_url = compat_urlparse . urlunparse ( parsed_caption_url . _replace (
query = compat_urllib_parse . urlencode( caption_qs , True ) ) )
query = compat_urllib_parse _ urlencode( caption_qs , True ) ) )
sub_formats . append ( {
' url ' : sub_url ,
' ext ' : ext ,
@ -1140,7 +1139,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
' cpn ' : [ cpn ] ,
} )
playback_url = compat_urlparse . urlunparse (
parsed_playback_url . _replace ( query = compat_urllib_parse . urlencode( qs , True ) ) )
parsed_playback_url . _replace ( query = compat_urllib_parse _ urlencode( qs , True ) ) )
self . _download_webpage (
playback_url , video_id , ' Marking watched ' ,
@ -1225,7 +1224,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
# this can be viewed without login into Youtube
url = proto + ' ://www.youtube.com/embed/ %s ' % video_id
embed_webpage = self . _download_webpage ( url , video_id , ' Downloading embed webpage ' )
data = compat_urllib_parse . urlencode( {
data = compat_urllib_parse _ urlencode( {
' video_id ' : video_id ,
' eurl ' : ' https://youtube.googleapis.com/v/ ' + video_id ,
' sts ' : self . _search_regex (
@ -2085,7 +2084,7 @@ class YoutubeSearchIE(SearchInfoExtractor, YoutubePlaylistIE):
' spf ' : ' navigate ' ,
}
url_query . update ( self . _EXTRA_QUERY_ARGS )
result_url = ' https://www.youtube.com/results? ' + compat_urllib_parse . urlencode( url_query )
result_url = ' https://www.youtube.com/results? ' + compat_urllib_parse _ urlencode( url_query )
data = self . _download_json (
result_url , video_id = ' query " %s " ' % query ,
note = ' Downloading page %s ' % pagenum ,