]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
Use urlencode_postdata across the codebase
authorSergey M․ <dstftw@gmail.com>
Fri, 25 Mar 2016 20:19:24 +0000 (02:19 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 25 Mar 2016 20:19:24 +0000 (02:19 +0600)
36 files changed:
youtube_dl/extractor/atresplayer.py
youtube_dl/extractor/bambuser.py
youtube_dl/extractor/ceskatelevize.py
youtube_dl/extractor/crunchyroll.py
youtube_dl/extractor/dcn.py
youtube_dl/extractor/dramafever.py
youtube_dl/extractor/fc2.py
youtube_dl/extractor/gdcvault.py
youtube_dl/extractor/hotnewhiphop.py
youtube_dl/extractor/lynda.py
youtube_dl/extractor/metacafe.py
youtube_dl/extractor/minhateca.py
youtube_dl/extractor/moevideo.py
youtube_dl/extractor/moniker.py
youtube_dl/extractor/mooshare.py
youtube_dl/extractor/nfb.py
youtube_dl/extractor/niconico.py
youtube_dl/extractor/noco.py
youtube_dl/extractor/played.py
youtube_dl/extractor/pluralsight.py
youtube_dl/extractor/primesharetv.py
youtube_dl/extractor/promptfile.py
youtube_dl/extractor/shared.py
youtube_dl/extractor/sharesix.py
youtube_dl/extractor/smotri.py
youtube_dl/extractor/soundcloud.py
youtube_dl/extractor/streamcloud.py
youtube_dl/extractor/tubitv.py
youtube_dl/extractor/twitch.py
youtube_dl/extractor/udemy.py
youtube_dl/extractor/vbox7.py
youtube_dl/extractor/vk.py
youtube_dl/extractor/vodlocker.py
youtube_dl/extractor/xfileshare.py
youtube_dl/extractor/yandexmusic.py
youtube_dl/extractor/youtube.py

index f9568cb5b89ad554cdfc6b1c08b99788e840a20a..d2f3889645f9b9324deb0eda00d4f6b67ab32dc1 100644 (file)
@@ -6,16 +6,14 @@ import hashlib
 import re
 
 from .common import InfoExtractor
-from ..compat import (
-    compat_str,
-    compat_urllib_parse_urlencode,
-)
+from ..compat import compat_str
 from ..utils import (
-    int_or_none,
+    ExtractorError,
     float_or_none,
+    int_or_none,
     sanitized_Request,
+    urlencode_postdata,
     xpath_text,
-    ExtractorError,
 )
 
 
@@ -86,7 +84,7 @@ class AtresPlayerIE(InfoExtractor):
         }
 
         request = sanitized_Request(
-            self._LOGIN_URL, compat_urllib_parse_urlencode(login_form).encode('utf-8'))
+            self._LOGIN_URL, urlencode_postdata(login_form))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
         response = self._download_webpage(
             request, None, 'Logging in as %s' % username)
index 1a2eef48dcbff701977103ae5d865debaa4906fa..0eb1930c2d24bb01acd57292d4fe7e1b9a330bff 100644 (file)
@@ -4,15 +4,13 @@ import re
 import itertools
 
 from .common import InfoExtractor
-from ..compat import (
-    compat_urllib_parse_urlencode,
-    compat_str,
-)
+from ..compat import compat_str
 from ..utils import (
     ExtractorError,
-    int_or_none,
     float_or_none,
+    int_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -58,7 +56,7 @@ class BambuserIE(InfoExtractor):
         }
 
         request = sanitized_Request(
-            self._LOGIN_URL, compat_urllib_parse_urlencode(login_form).encode('utf-8'))
+            self._LOGIN_URL, urlencode_postdata(login_form))
         request.add_header('Referer', self._LOGIN_URL)
         response = self._download_webpage(
             request, None, 'Logging in as %s' % username)
index d93108df5425b1a2f3296c22e7e8ced0438c9a00..6652c8e42a279f45bdbbc1af3d36ad2500a454eb 100644 (file)
@@ -6,13 +6,13 @@ import re
 from .common import InfoExtractor
 from ..compat import (
     compat_urllib_parse_unquote,
-    compat_urllib_parse_urlencode,
     compat_urllib_parse_urlparse,
 )
 from ..utils import (
     ExtractorError,
     float_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -102,7 +102,7 @@ class CeskaTelevizeIE(InfoExtractor):
 
         req = sanitized_Request(
             'http://www.ceskatelevize.cz/ivysilani/ajax/get-client-playlist',
-            data=compat_urllib_parse_urlencode(data))
+            data=urlencode_postdata(data))
 
         req.add_header('Content-type', 'application/x-www-form-urlencoded')
         req.add_header('x-addr', '127.0.0.1')
index 7746f1be3198186865cd676dc7682defdb78a395..8ae3f28903deeb94cd723c7f431a3c86a45538ea 100644 (file)
@@ -308,7 +308,7 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
 
         playerdata_url = compat_urllib_parse_unquote(self._html_search_regex(r'"config_url":"([^"]+)', webpage, 'playerdata_url'))
         playerdata_req = sanitized_Request(playerdata_url)
-        playerdata_req.data = compat_urllib_parse_urlencode({'current_page': webpage_url})
+        playerdata_req.data = urlencode_postdata({'current_page': webpage_url})
         playerdata_req.add_header('Content-Type', 'application/x-www-form-urlencoded')
         playerdata = self._download_webpage(playerdata_req, video_id, note='Downloading media info')
 
index 982ed94ea403f9ab98c4d505cff575be180e3cb0..5deff5f30ea22592c24015b6b78546175b0f498e 100644 (file)
@@ -15,6 +15,7 @@ from ..utils import (
     sanitized_Request,
     smuggle_url,
     unsmuggle_url,
+    urlencode_postdata,
 )
 
 
@@ -174,7 +175,7 @@ class DCNSeasonIE(InfoExtractor):
         data['show_id'] = show_id
         request = sanitized_Request(
             'http://admin.mangomolo.com/analytics/index.php/plus/show',
-            compat_urllib_parse_urlencode(data),
+            urlencode_postdata(data),
             {
                 'Origin': 'http://www.dcndigital.ae',
                 'Content-Type': 'application/x-www-form-urlencoded'
index 2101acaafd94919e246ecd3ae8b9fdd559816a7d..3b6529f4b108052e3019c8e400bbc2cd0eb5a9a1 100644 (file)
@@ -6,7 +6,6 @@ import itertools
 from .amp import AMPIE
 from ..compat import (
     compat_HTTPError,
-    compat_urllib_parse_urlencode,
     compat_urlparse,
 )
 from ..utils import (
@@ -14,6 +13,7 @@ from ..utils import (
     clean_html,
     int_or_none,
     sanitized_Request,
+    urlencode_postdata
 )
 
 
@@ -50,7 +50,7 @@ class DramaFeverBaseIE(AMPIE):
         }
 
         request = sanitized_Request(
-            self._LOGIN_URL, compat_urllib_parse_urlencode(login_form).encode('utf-8'))
+            self._LOGIN_URL, urlencode_postdata(login_form))
         response = self._download_webpage(
             request, None, 'Logging in as %s' % username)
 
index cacf61973082e01057b13fdb9174692e625d0d5b..c7d69ff1f980de46bd4ecce96e4ac301b1f1be59 100644 (file)
@@ -5,13 +5,13 @@ import hashlib
 
 from .common import InfoExtractor
 from ..compat import (
-    compat_urllib_parse_urlencode,
     compat_urllib_request,
     compat_urlparse,
 )
 from ..utils import (
     ExtractorError,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -56,7 +56,7 @@ class FC2IE(InfoExtractor):
             'Submit': ' Login ',
         }
 
-        login_data = compat_urllib_parse_urlencode(login_form_strs).encode('utf-8')
+        login_data = urlencode_postdata(login_form_strs)
         request = sanitized_Request(
             'https://secure.id.fc2.com/index.php?mode=login&switch_language=en', login_data)
 
index cc8fa45d29e2bc79807d1101aecdec05aa3466d1..59ed4c38f654f75c2217ce04e1f350295c871de7 100644 (file)
@@ -3,11 +3,11 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     remove_end,
     HEADRequest,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -123,7 +123,7 @@ class GDCVaultIE(InfoExtractor):
             'password': password,
         }
 
-        request = sanitized_Request(login_url, compat_urllib_parse_urlencode(login_form))
+        request = sanitized_Request(login_url, urlencode_postdata(login_form))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
         self._download_webpage(request, display_id, 'Logging in')
         start_page = self._download_webpage(webpage_url, display_id, 'Getting authenticated video page')
index 152d2a98a1ecb4bd8059631355adf72e1d4d1c19..9db5652096acc5ead0cb926791d731d0f6f35565 100644 (file)
@@ -3,11 +3,11 @@ from __future__ import unicode_literals
 import base64
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     HEADRequest,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -35,7 +35,7 @@ class HotNewHipHopIE(InfoExtractor):
                 r'"contentUrl" content="(.*?)"', webpage, 'content URL')
             return self.url_result(video_url, ie='Youtube')
 
-        reqdata = compat_urllib_parse_urlencode([
+        reqdata = urlencode_postdata([
             ('mediaType', 's'),
             ('mediaId', video_id),
         ])
index df50cb655365223dd6335c9772dca9a6bbad7091..71fd55ade7c22138f41e444e8e7bed483cc789b2 100644 (file)
@@ -4,15 +4,13 @@ import re
 import json
 
 from .common import InfoExtractor
-from ..compat import (
-    compat_str,
-    compat_urllib_parse_urlencode,
-)
+from ..compat import compat_str
 from ..utils import (
     ExtractorError,
     clean_html,
     int_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -36,7 +34,7 @@ class LyndaBaseIE(InfoExtractor):
             'stayPut': 'false'
         }
         request = sanitized_Request(
-            self._LOGIN_URL, compat_urllib_parse_urlencode(login_form).encode('utf-8'))
+            self._LOGIN_URL, urlencode_postdata(login_form))
         login_page = self._download_webpage(
             request, None, 'Logging in as %s' % username)
 
@@ -65,7 +63,7 @@ class LyndaBaseIE(InfoExtractor):
                     'stayPut': 'false',
                 }
                 request = sanitized_Request(
-                    self._LOGIN_URL, compat_urllib_parse_urlencode(confirm_form).encode('utf-8'))
+                    self._LOGIN_URL, urlencode_postdata(confirm_form))
                 login_page = self._download_webpage(
                     request, None,
                     'Confirming log in and log out from another device')
index 0e486544616583a4c5a8ed6cce96264152dbfcae..61dadb7a7de9cbd6134e4a285e655487276c4bce 100644 (file)
@@ -6,13 +6,13 @@ from .common import InfoExtractor
 from ..compat import (
     compat_parse_qs,
     compat_urllib_parse_unquote,
-    compat_urllib_parse_urlencode,
 )
 from ..utils import (
     determine_ext,
     ExtractorError,
     int_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -117,7 +117,7 @@ class MetacafeIE(InfoExtractor):
             'filters': '0',
             'submit': "Continue - I'm over 18",
         }
-        request = sanitized_Request(self._FILTER_POST, compat_urllib_parse_urlencode(disclaimer_form))
+        request = sanitized_Request(self._FILTER_POST, urlencode_postdata(disclaimer_form))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
         self.report_age_confirmation()
         self._download_webpage(request, None, False, 'Unable to confirm age')
index 6ec53c3036ef044eb7761719c95db4ed982dea37..e6730b75a68d27c16e694fedaac088d27a0ab1ec 100644 (file)
@@ -2,12 +2,12 @@
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     int_or_none,
     parse_duration,
     parse_filesize,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -39,7 +39,7 @@ class MinhatecaIE(InfoExtractor):
         ]
         req = sanitized_Request(
             'http://minhateca.com.br/action/License/Download',
-            data=compat_urllib_parse_urlencode(token_data))
+            data=urlencode_postdata(token_data))
         req.add_header('Content-Type', 'application/x-www-form-urlencoded')
         data = self._download_json(
             req, video_id, note='Downloading metadata')
index 89cdd46000eb489f5f249eadeefc2b877f6b7fcb..978d5d5bfeaf5ff64b7279343876a3177c43339a 100644 (file)
@@ -5,11 +5,11 @@ import json
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     int_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -77,7 +77,7 @@ class MoeVideoIE(InfoExtractor):
             ],
         ]
         r_json = json.dumps(r)
-        post = compat_urllib_parse_urlencode({'r': r_json})
+        post = urlencode_postdata({'r': r_json})
         req = sanitized_Request(self._API_URL, post)
         req.add_header('Content-type', 'application/x-www-form-urlencoded')
 
index c5ce693f15e55278883b576b8cb3f9095a63f223..b208820fe64970b3f7b362dba13c534a6955686d 100644 (file)
@@ -5,11 +5,11 @@ import os.path
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     remove_start,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -88,7 +88,7 @@ class MonikerIE(InfoExtractor):
             fields = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', orig_webpage)
             data = dict(fields)
 
-            post = compat_urllib_parse_urlencode(data)
+            post = urlencode_postdata(data)
             headers = {
                 b'Content-Type': b'application/x-www-form-urlencoded',
             }
index ee3947f43807055c577641e439096f61981c7575..a85109a89fea66ab16722c09bf8a5b9b06ad7998 100644 (file)
@@ -3,10 +3,10 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -58,7 +58,7 @@ class MooshareIE(InfoExtractor):
         }
 
         request = sanitized_Request(
-            'http://mooshare.biz/%s' % video_id, compat_urllib_parse_urlencode(download_form))
+            'http://mooshare.biz/%s' % video_id, urlencode_postdata(download_form))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
 
         self._sleep(5, video_id)
index ba1eefafcae131f031685d97f84521858cdf89ba..51e4a34f789f0e7e9dff2eeb9ec839e655632c75 100644 (file)
@@ -1,8 +1,10 @@
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
-from ..utils import sanitized_Request
+from ..utils import (
+    sanitized_Request,
+    urlencode_postdata,
+)
 
 
 class NFBIE(InfoExtractor):
@@ -40,7 +42,7 @@ class NFBIE(InfoExtractor):
 
         request = sanitized_Request(
             'https://www.nfb.ca/film/%s/player_config' % video_id,
-            compat_urllib_parse_urlencode({'getConfig': 'true'}).encode('ascii'))
+            urlencode_postdata({'getConfig': 'true'}))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
         request.add_header('X-NFB-Referer', 'http://www.nfb.ca/medias/flash/NFBVideoPlayer.swf')
 
index 688f0a124629f0aa15ae2057e25ebca31c461557..dd75a48afcc9dfa4a728c600c836741785056770 100644 (file)
@@ -18,6 +18,7 @@ from ..utils import (
     sanitized_Request,
     xpath_text,
     determine_ext,
+    urlencode_postdata,
 )
 
 
@@ -100,7 +101,7 @@ class NiconicoIE(InfoExtractor):
             'mail': username,
             'password': password,
         }
-        login_data = compat_urllib_parse_urlencode(login_form_strs).encode('utf-8')
+        login_data = urlencode_postdata(login_form_strs)
         request = sanitized_Request(
             'https://secure.nicovideo.jp/secure/login', login_data)
         login_results = self._download_webpage(
index 8f4b69a6fd646ed52debc3de2f04b573869870d0..06f2bda07dd5db2c54e1e0492f244dbf0fc5a526 100644 (file)
@@ -8,7 +8,6 @@ import hashlib
 from .common import InfoExtractor
 from ..compat import (
     compat_str,
-    compat_urllib_parse_urlencode,
     compat_urlparse,
 )
 from ..utils import (
@@ -18,6 +17,7 @@ from ..utils import (
     float_or_none,
     parse_iso8601,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -75,7 +75,7 @@ class NocoIE(InfoExtractor):
             'username': username,
             'password': password,
         }
-        request = sanitized_Request(self._LOGIN_URL, compat_urllib_parse_urlencode(login_form))
+        request = sanitized_Request(self._LOGIN_URL, urlencode_postdata(login_form))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
 
         login = self._download_json(request, None, 'Logging in as %s' % username)
index 63065622bd21bf3145dcfae1fa25dc76e99f4f45..57c875ef05dd74a429ea55313b0d956ef7e5ec56 100644 (file)
@@ -5,10 +5,10 @@ import re
 import os.path
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -40,7 +40,7 @@ class PlayedIE(InfoExtractor):
 
         self._sleep(2, video_id)
 
-        post = compat_urllib_parse_urlencode(data)
+        post = urlencode_postdata(data)
         headers = {
             b'Content-Type': b'application/x-www-form-urlencoded',
         }
index 575775f097e4ad609f1b1fde0c152f07fd2c4a51..bc66f7a9d18e8bce3f0e14fe3b7f9fb5bfd0511f 100644 (file)
@@ -8,7 +8,6 @@ import collections
 from .common import InfoExtractor
 from ..compat import (
     compat_str,
-    compat_urllib_parse_urlencode,
     compat_urlparse,
 )
 from ..utils import (
@@ -17,6 +16,7 @@ from ..utils import (
     parse_duration,
     qualities,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -76,7 +76,7 @@ class PluralsightIE(PluralsightBaseIE):
             post_url = compat_urlparse.urljoin(self._LOGIN_URL, post_url)
 
         request = sanitized_Request(
-            post_url, compat_urllib_parse_urlencode(login_form).encode('utf-8'))
+            post_url, urlencode_postdata(login_form))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
 
         response = self._download_webpage(
index 188f0882652f32c3a2eb8cd050f4fdfd3a771cf0..0c1024772c860404209bd3b3f2a183d90c41face 100644 (file)
@@ -1,10 +1,10 @@
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -42,7 +42,7 @@ class PrimeShareTVIE(InfoExtractor):
         self._sleep(wait_time, video_id)
 
         req = sanitized_Request(
-            url, compat_urllib_parse_urlencode(fields), headers)
+            url, urlencode_postdata(fields), headers)
         video_page = self._download_webpage(
             req, video_id, 'Downloading video page')
 
index 67312016c4def2cd604d03b7598012cc5b083c19..f93bd19ff6dde40c87672b4fd18a3f1aab11382e 100644 (file)
@@ -4,11 +4,11 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     determine_ext,
     ExtractorError,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -34,7 +34,7 @@ class PromptFileIE(InfoExtractor):
                                  expected=True)
 
         fields = self._hidden_inputs(webpage)
-        post = compat_urllib_parse_urlencode(fields)
+        post = urlencode_postdata(fields)
         req = sanitized_Request(url, post)
         req.add_header('Content-type', 'application/x-www-form-urlencoded')
         webpage = self._download_webpage(
index e6644199711ab22364909ef3c91a44981449999b..e7e5f653eb2117936f568195e508f9e7778b1085 100644 (file)
@@ -3,11 +3,11 @@ from __future__ import unicode_literals
 import base64
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     int_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -45,7 +45,7 @@ class SharedIE(InfoExtractor):
 
         download_form = self._hidden_inputs(webpage)
         request = sanitized_Request(
-            url, compat_urllib_parse_urlencode(download_form))
+            url, urlencode_postdata(download_form))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
 
         video_page = self._download_webpage(
index 61dc1c23539ad8b487cb78d70f0881c910f3fad5..9cce5ceb43b71877202a77067458a39e5a810432 100644 (file)
@@ -4,10 +4,10 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     parse_duration,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -47,7 +47,7 @@ class ShareSixIE(InfoExtractor):
         fields = {
             'method_free': 'Free'
         }
-        post = compat_urllib_parse_urlencode(fields)
+        post = urlencode_postdata(fields)
         req = sanitized_Request(url, post)
         req.add_header('Content-type', 'application/x-www-form-urlencoded')
 
index b4c6d5bbf7c359f1a02952abcc03f6d0c046dd78..5c3fd0fece8dc8b32a3d05bea8ed4dedf430f1c5 100644 (file)
@@ -7,12 +7,12 @@ import hashlib
 import uuid
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     int_or_none,
     sanitized_Request,
     unified_strdate,
+    urlencode_postdata,
 )
 
 
@@ -175,7 +175,7 @@ class SmotriIE(InfoExtractor):
             video_form['pass'] = hashlib.md5(video_password.encode('utf-8')).hexdigest()
 
         request = sanitized_Request(
-            'http://smotri.com/video/view/url/bot/', compat_urllib_parse_urlencode(video_form))
+            'http://smotri.com/video/view/url/bot/', urlencode_postdata(video_form))
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
 
         video = self._download_json(request, video_id, 'Downloading video JSON')
@@ -338,7 +338,7 @@ class SmotriBroadcastIE(InfoExtractor):
             }
 
             request = sanitized_Request(
-                broadcast_url + '/?no_redirect=1', compat_urllib_parse_urlencode(login_form))
+                broadcast_url + '/?no_redirect=1', urlencode_postdata(login_form))
             request.add_header('Content-Type', 'application/x-www-form-urlencoded')
             broadcast_page = self._download_webpage(
                 request, broadcast_id, 'Logging in and confirming age')
index 2bca8fa3a0db5a9bf419df78844cd8eafb822454..194dabc71d84072fc64afd50baa3b80467c0808f 100644 (file)
@@ -500,7 +500,6 @@ class SoundcloudSearchIE(SearchInfoExtractor, SoundcloudIE):
         query['linked_partitioning'] = '1'
         query['offset'] = 0
         data = compat_urllib_parse_urlencode(query)
-        data = compat_urllib_parse_urlencode(query)
         next_url = '{0}{1}?{2}'.format(self._API_V2_BASE, endpoint, data)
 
         collected_results = 0
index b17779e4bd5c1171a6415eb3bdd032c00f78df08..712359885fde90fa3032aeff1b2cb74afb761f35 100644 (file)
@@ -4,8 +4,10 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
-from ..utils import sanitized_Request
+from ..utils import (
+    sanitized_Request,
+    urlencode_postdata,
+)
 
 
 class StreamcloudIE(InfoExtractor):
@@ -35,7 +37,7 @@ class StreamcloudIE(InfoExtractor):
             (?:id="[^"]+"\s+)?
             value="([^"]*)"
             ''', orig_webpage)
-        post = compat_urllib_parse_urlencode(fields)
+        post = urlencode_postdata(fields)
 
         self._sleep(12, video_id)
         headers = {
index 50ed151636d4e8f46781780799c5fe49a5a2b75d..306ee4e158b759a2743700c8794def76091767ad 100644 (file)
@@ -5,11 +5,11 @@ import codecs
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     int_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -41,7 +41,7 @@ class TubiTvIE(InfoExtractor):
             'username': username,
             'password': password,
         }
-        payload = compat_urllib_parse_urlencode(form_data).encode('utf-8')
+        payload = urlencode_postdata(form_data)
         request = sanitized_Request(self._LOGIN_URL, payload)
         request.add_header('Content-Type', 'application/x-www-form-urlencoded')
         login_page = self._download_webpage(
index c92dcc7b90f151a9ed05e82428dc14691b43e220..36ee1adff2288570fc39936640bacd3abafe9ed2 100644 (file)
@@ -20,6 +20,7 @@ from ..utils import (
     parse_duration,
     parse_iso8601,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -81,7 +82,7 @@ class TwitchBaseIE(InfoExtractor):
             post_url = compat_urlparse.urljoin(redirect_url, post_url)
 
         request = sanitized_Request(
-            post_url, compat_urllib_parse_urlencode(login_form).encode('utf-8'))
+            post_url, urlencode_postdata(login_form))
         request.add_header('Referer', redirect_url)
         response = self._download_webpage(
             request, None, 'Logging in as %s' % username)
index 6adfb2ceea8b1d15bd124a173e9a702a49e35735..be6f3be5ed4ee395a64daa3ee7e9e8cc5e6ba542 100644 (file)
@@ -13,6 +13,7 @@ from ..utils import (
     int_or_none,
     sanitized_Request,
     unescapeHTML,
+    urlencode_postdata,
 )
 
 
@@ -139,7 +140,7 @@ class UdemyIE(InfoExtractor):
         })
 
         request = sanitized_Request(
-            self._LOGIN_URL, compat_urllib_parse_urlencode(login_form).encode('utf-8'))
+            self._LOGIN_URL, urlencode_postdata(login_form))
         request.add_header('Referer', self._ORIGIN_URL)
         request.add_header('Origin', self._ORIGIN_URL)
 
index 77bb200e960f4ece75c146e3404451eab3470ecb..dff1bb70281b9a1cd69d9507b963e4c622a29044 100644 (file)
@@ -2,13 +2,11 @@
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
-from ..compat import (
-    compat_urllib_parse_urlencode,
-    compat_urlparse,
-)
+from ..compat import compat_urlparse
 from ..utils import (
     ExtractorError,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -48,7 +46,7 @@ class Vbox7IE(InfoExtractor):
                                         webpage, 'title').split('/')[0].strip()
 
         info_url = 'http://vbox7.com/play/magare.do'
-        data = compat_urllib_parse_urlencode({'as3': '1', 'vid': video_id})
+        data = urlencode_postdata({'as3': '1', 'vid': video_id})
         info_request = sanitized_Request(info_url, data)
         info_request.add_header('Content-Type', 'application/x-www-form-urlencoded')
         info_response = self._download_webpage(info_request, video_id, 'Downloading info webpage')
index 458099a4ac427baf9dd0f9110276ea4dfc8a8e28..67220f1b7a991e48494adf24c791317e29eda8cd 100644 (file)
@@ -5,10 +5,7 @@ import re
 import json
 
 from .common import InfoExtractor
-from ..compat import (
-    compat_str,
-    compat_urllib_parse_urlencode,
-)
+from ..compat import compat_str
 from ..utils import (
     ExtractorError,
     int_or_none,
@@ -17,6 +14,7 @@ from ..utils import (
     str_to_int,
     unescapeHTML,
     unified_strdate,
+    urlencode_postdata,
 )
 from .vimeo import VimeoIE
 from .pladform import PladformIE
@@ -204,7 +202,7 @@ class VKIE(InfoExtractor):
 
         request = sanitized_Request(
             'https://login.vk.com/?act=login',
-            compat_urllib_parse_urlencode(login_form).encode('utf-8'))
+            urlencode_postdata(login_form))
         login_page = self._download_webpage(
             request, None, note='Logging in as %s' % username)
 
index f1abca4d9f2a7b43b2720d00db5b58b5b737c208..a938a4007ead91a25ca84b43307ce16e1787e2e6 100644 (file)
@@ -2,11 +2,11 @@
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     NO_DEFAULT,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -38,7 +38,7 @@ class VodlockerIE(InfoExtractor):
 
         if fields['op'] == 'download1':
             self._sleep(3, video_id)  # they do detect when requests happen too fast!
-            post = compat_urllib_parse_urlencode(fields)
+            post = urlencode_postdata(fields)
             req = sanitized_Request(url, post)
             req.add_header('Content-type', 'application/x-www-form-urlencoded')
             webpage = self._download_webpage(
index 4e35e1f4415b86833cc3aa200e0d736441739b5c..2d1504eaacd36eb564da06eb541d2b6b8eabaa44 100644 (file)
@@ -4,11 +4,11 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_urllib_parse_urlencode
 from ..utils import (
     ExtractorError,
     int_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -108,7 +108,7 @@ class XFileShareIE(InfoExtractor):
             if countdown:
                 self._sleep(countdown, video_id)
 
-            post = compat_urllib_parse_urlencode(fields)
+            post = urlencode_postdata(fields)
 
             req = sanitized_Request(url, post)
             req.add_header('Content-type', 'application/x-www-form-urlencoded')
index 158f3ea680c786844f3bf4a457ea4bfbc12e4a44..025716958caa292a9060290d194547054c93ca2b 100644 (file)
@@ -5,15 +5,13 @@ import re
 import hashlib
 
 from .common import InfoExtractor
-from ..compat import (
-    compat_str,
-    compat_urllib_parse_urlencode,
-)
+from ..compat import compat_str
 from ..utils import (
     ExtractorError,
     int_or_none,
     float_or_none,
     sanitized_Request,
+    urlencode_postdata,
 )
 
 
@@ -170,14 +168,14 @@ class YandexMusicPlaylistIE(YandexMusicPlaylistBaseIE):
             missing_track_ids = set(map(compat_str, track_ids)) - set(present_track_ids)
             request = sanitized_Request(
                 'https://music.yandex.ru/handlers/track-entries.jsx',
-                compat_urllib_parse_urlencode({
+                urlencode_postdata({
                     'entries': ','.join(missing_track_ids),
                     'lang': mu.get('settings', {}).get('lang', 'en'),
                     'external-domain': 'music.yandex.ru',
                     'overembed': 'false',
                     'sign': mu.get('authData', {}).get('user', {}).get('sign'),
                     'strict': 'true',
-                }).encode('utf-8'))
+                }))
             request.add_header('Referer', url)
             request.add_header('X-Requested-With', 'XMLHttpRequest')
 
index 83b5840f76c7c9aa76760457e9b87ce86e83e680..8c321f1fc930e0179336171b2f31200f5fcea5aa 100644 (file)
@@ -44,6 +44,7 @@ from ..utils import (
     unified_strdate,
     unsmuggle_url,
     uppercase_escape,
+    urlencode_postdata,
     ISO3166Utils,
 )
 
@@ -115,7 +116,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
             'hl': 'en_US',
         }
 
-        login_data = compat_urllib_parse_urlencode(login_form_strs).encode('ascii')
+        login_data = urlencode_postdata(login_form_strs)
 
         req = sanitized_Request(self._LOGIN_URL, login_data)
         login_results = self._download_webpage(
@@ -148,7 +149,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
                 'TrustDevice': 'on',
             })
 
-            tfa_data = compat_urllib_parse_urlencode(tfa_form_strs).encode('ascii')
+            tfa_data = urlencode_postdata(tfa_form_strs)
 
             tfa_req = sanitized_Request(self._TWOFACTOR_URL, tfa_data)
             tfa_results = self._download_webpage(