[utils] add update_url_query function
authorremitamine <remitamine@gmail.com>
Thu, 3 Mar 2016 17:34:52 +0000 (18:34 +0100)
committerremitamine <remitamine@gmail.com>
Thu, 3 Mar 2016 17:34:52 +0000 (18:34 +0100)
youtube_dl/extractor/common.py
youtube_dl/utils.py

index a95387cee4d2e601a1c42d4c784c5cce96735026..402f2f436dcd59bf00821166625eb72144b16a07 100644 (file)
@@ -20,7 +20,6 @@ from ..compat import (
     compat_urllib_error,
     compat_urllib_parse,
     compat_urlparse,
-    compat_parse_qs,
     compat_str,
     compat_etree_fromstring,
 )
@@ -518,13 +517,6 @@ class InfoExtractor(object):
             else:
                 self.report_warning(errmsg + str(ve))
 
-    def update_url_params(self, url, params):
-        parsed_url = compat_urlparse.urlparse(url)
-        qs = compat_parse_qs(parsed_url.query)
-        qs.update(params)
-        return compat_urlparse.urlunparse(
-            parsed_url._replace(query=compat_urllib_parse.urlencode(qs, True)))
-
     def report_warning(self, msg, video_id=None):
         idstr = '' if video_id is None else '%s: ' % video_id
         self._downloader.report_warning(
index 210c47fce873096c995c2a69be0108bba7549c29..31d60f3233bb3ea95775f390d4f4afc0681b52d3 100644 (file)
@@ -1719,6 +1719,14 @@ def urlencode_postdata(*args, **kargs):
     return compat_urllib_parse.urlencode(*args, **kargs).encode('ascii')
 
 
+def update_url_query(url, query):
+    parsed_url = compat_urlparse.urlparse(url)
+    qs = compat_parse_qs(parsed_url.query)
+    qs.update(query)
+    return compat_urlparse.urlunparse(parsed_url._replace(
+        query=compat_urllib_parse.urlencode(qs, True)))
+
+
 def encode_dict(d, encoding='utf-8'):
     def encode(v):
         return v.encode(encoding) if isinstance(v, compat_basestring) else v