From 3adfe210e563c6cf47d07530f103fa690020c715 Mon Sep 17 00:00:00 2001 From: GZZ Date: Mon, 11 Mar 2024 22:12:56 +0800 Subject: [PATCH 1/2] fix vimeo config parser regex --- youtube_dl/extractor/vimeo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/vimeo.py b/youtube_dl/extractor/vimeo.py index 8e1a805f640..6f1a99bf5b7 100644 --- a/youtube_dl/extractor/vimeo.py +++ b/youtube_dl/extractor/vimeo.py @@ -674,7 +674,7 @@ def _real_extract(self, url): if '//player.vimeo.com/video/' in url: config = self._parse_json(self._search_regex( - r'(?s)\b(?:playerC|c)onfig\s*=\s*({.+?})\s*[;\n]', webpage, 'info section'), video_id) + r'(?s)\b(?:playerC|c)onfig\s*=\s*({.+?})\s*(?:;|\n|\<\/script\>)', webpage, 'info section'), video_id) if config.get('view') == 4: config = self._verify_player_video_password( redirect_url, video_id, headers) From 7b8cb3ea12da8c2f0db5ea67855ed66d23b5f01c Mon Sep 17 00:00:00 2001 From: GZZ Date: Tue, 12 Mar 2024 09:35:05 +0800 Subject: [PATCH 2/2] update vimeo.py for more robust json parsing, according to dirkf's suggestions --- youtube_dl/extractor/vimeo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/vimeo.py b/youtube_dl/extractor/vimeo.py index 6f1a99bf5b7..47ec0a9b449 100644 --- a/youtube_dl/extractor/vimeo.py +++ b/youtube_dl/extractor/vimeo.py @@ -673,8 +673,8 @@ def _real_extract(self, url): raise if '//player.vimeo.com/video/' in url: - config = self._parse_json(self._search_regex( - r'(?s)\b(?:playerC|c)onfig\s*=\s*({.+?})\s*(?:;|\n|\<\/script\>)', webpage, 'info section'), video_id) + config = self._search_json( + r'\b(?:playerC|c)onfig\s*=', webpage, 'info section', video_id) if config.get('view') == 4: config = self._verify_player_video_password( redirect_url, video_id, headers)