[extractor/common] add update_url_params helper method to add or update query string params

pull/8/head
remitamine 2016-03-03 10:27:22 +01:00
rodzic 03879ff054
commit f3bdae76de
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -517,6 +517,13 @@ 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_urlparse.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(