[youtube] sloppy fix

This commit is contained in:
Mort Yao 2024-07-24 00:26:54 +02:00
parent aba2852f84
commit 899e2b6b2b
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -201,7 +201,7 @@ class YouTube(VideoExtractor):
self.js = get_content(self.html5player).replace('\n', ' ') self.js = get_content(self.html5player).replace('\n', ' ')
logging.debug('Loading ytInitialPlayerResponse...') logging.debug('Loading ytInitialPlayerResponse...')
ytInitialPlayerResponse = json.loads(re.search('ytInitialPlayerResponse\s*=\s*([^\n]+?});(\n|</script>)', video_page).group(1)) ytInitialPlayerResponse = json.loads(re.search('ytInitialPlayerResponse\s*=\s*([^\n]+?});(\n|</script>|var )', video_page).group(1))
# Get the video title # Get the video title
self.title = ytInitialPlayerResponse["videoDetails"]["title"] self.title = ytInitialPlayerResponse["videoDetails"]["title"]