mirror of
https://github.com/yt-dlp/yt-dlp
synced 2025-12-17 22:55:42 +07:00
some fixes, pulled the codename from the code
This commit is contained in:
@@ -154,6 +154,7 @@ def compat_parse_qs(qs, keep_blank_values=False, strict_parsing=False,
|
||||
'Accept-Encoding': 'gzip, deflate',
|
||||
'Accept-Language': 'en-us,en;q=0.5',
|
||||
}
|
||||
|
||||
def preferredencoding():
|
||||
"""Get preferred encoding.
|
||||
|
||||
@@ -187,6 +188,11 @@ def write_json_file(obj, fn):
|
||||
with open(fn, 'w', encoding='utf-8') as f:
|
||||
json.dump(obj, f)
|
||||
|
||||
# Some library functions return bytestring on 2.X and unicode on 3.X
|
||||
def enforce_unicode(s, encoding='utf-8'):
|
||||
if type(s) != type(u''):
|
||||
return s.decode(encoding)
|
||||
return s
|
||||
|
||||
def htmlentity_transform(matchobj):
|
||||
"""Transforms an HTML entity to a character.
|
||||
|
||||
Reference in New Issue
Block a user