diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index a2986cebe5..77726ee243 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -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']+charset="?([^"]+)[ /">]', + m = re.search(br']+charset=[\'"]?([^\'")]+)[ /\'">]', webpage_bytes[:1024]) if m: encoding = m.group(1).decode('ascii')