mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-28 15:46:54 +01:00
[extractor/common] add update_url_params helper method to add or update query string params
This commit is contained in:
parent
03879ff054
commit
f3bdae76de
@ -517,6 +517,13 @@ def _parse_json(self, json_string, video_id, transform_source=None, fatal=True):
|
|||||||
else:
|
else:
|
||||||
self.report_warning(errmsg + str(ve))
|
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):
|
def report_warning(self, msg, video_id=None):
|
||||||
idstr = '' if video_id is None else '%s: ' % video_id
|
idstr = '' if video_id is None else '%s: ' % video_id
|
||||||
self._downloader.report_warning(
|
self._downloader.report_warning(
|
||||||
|
Loading…
Reference in New Issue
Block a user