0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-26 02:55:17 +00:00

Fix detection of the webpage charset if it's declared using ' instead of "

Like in "<meta charset='utf-8'/>"
This commit is contained in:
Jaime Marquínez Ferrándiz 2013-08-29 11:35:15 +02:00
parent 2891932bf0
commit 0d75ae2ce3

View file

@ -150,7 +150,7 @@ def _download_webpage_handle(self, url_or_request, video_id, note=None, errnote=
if m:
encoding = m.group(1)
else:
m = re.search(br'<meta[^>]+charset="?([^"]+)[ /">]',
m = re.search(br'<meta[^>]+charset=[\'"]?([^\'")]+)[ /\'">]',
webpage_bytes[:1024])
if m:
encoding = m.group(1).decode('ascii')