]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[youtube] Clarify ytplayer.config extraction rationale
authorSergey M․ <dstftw@gmail.com>
Mon, 23 Nov 2015 15:14:03 +0000 (21:14 +0600)
committerSergey M․ <dstftw@gmail.com>
Mon, 23 Nov 2015 15:14:03 +0000 (21:14 +0600)
youtube_dl/extractor/youtube.py

index 824335d0ac9bbe1743a94257b3e55d58181e2982..5482aac3b5ccf332867c451637092df6f994db10 100644 (file)
@@ -898,6 +898,13 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
 
     def _get_ytplayer_config(self, video_id, webpage):
         patterns = (
+            # User data may contain arbitrary character sequences that may affect
+            # JSON extraction with regex, e.g. when '};' is contained the second
+            # regex won't capture the whole JSON. Yet working around by trying more
+            # concrete regex first keeping in mind proper quoted string handling
+            # to be implemented in future that will replace this workaround (see
+            # https://github.com/rg3/youtube-dl/issues/7468,
+            # https://github.com/rg3/youtube-dl/pull/7599)
             r';ytplayer\.config\s*=\s*({.+?});ytplayer',
             r';ytplayer\.config\s*=\s*({.+?});',
         )