Fixed to handle YouTube JS changes
authorJames Bunton <jamesbunton@delx.net.au>
Wed, 1 Feb 2017 21:39:52 +0000 (08:39 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Wed, 1 Feb 2017 21:40:05 +0000 (08:40 +1100)
youtube.cgi

index 338fac5..1a80bf7 100755 (executable)
@@ -80,7 +80,9 @@ referrer = ""
 
 def urlopen(url, offset=None):
     if url.startswith("//"):
-        url = "http:" + url
+        url = "https:" + url
+    if not url.startswith("http://") and not url.startswith("https://"):
+        url = "https://www.youtube.com" + url
 
     global referrer
     req = urllib2.Request(url)
@@ -142,7 +144,7 @@ def extract_js(script):
 def find_func_name(script):
     FUNC_NAME = R"([a-zA-Z0-9$]+)"
     FUNC_PARAMS = R"(\([a-zA-Z]+\.s\))"
-    TERMINATOR = R"[,;]"
+    TERMINATOR = R"[,;\)]"
     PATTERN = FUNC_NAME + FUNC_PARAMS + TERMINATOR
 
     match = re.search(PATTERN, script)