From 87706c5ec86191a3d107159d0380f2058ce1708a Mon Sep 17 00:00:00 2001 From: changren-wcr <105254603+changren-wcr@users.noreply.github.com> Date: Thu, 16 Jun 2022 19:08:09 +0800 Subject: [PATCH] Use _search_regex() to get proper error reports in youtube-dl Co-authored-by: dirkf --- youtube_dl/extractor/qingting.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/qingting.py b/youtube_dl/extractor/qingting.py index eed345d38..831659303 100644 --- a/youtube_dl/extractor/qingting.py +++ b/youtube_dl/extractor/qingting.py @@ -23,7 +23,13 @@ class QingTingIE(InfoExtractor): video_id = re.search(self._VALID_URL, url).group('id') webpage = self._download_webpage(url, video_id) title = self._html_search_regex(r'(.*)', webpage, 'title') or self._og_search_title(webpage) - url = re.search(r'\"audioUrl\"\s*:\s*\"(?P.*?)\"', webpage).group('url') + url = self._search_regex( + r'''("|')audioUrl\1\s*:\s*("|')(?P(?:(?!\2).)*)\2''', + webpage, 'audio URL') + test_url = url_or_none(url) + if not test_url: + raise ExtractorError('Invalid audio URL %s' % (url, )) + url = test_url return { 'id': video_id, 'title': title,