From: James Bunton Date: Wed, 1 Feb 2017 21:39:52 +0000 (+1100) Subject: Fixed to handle YouTube JS changes X-Git-Url: https://code.delx.au/youtube-cgi/commitdiff_plain/e933b8f5b3b40b610f2681163ec4fea3092968e4 Fixed to handle YouTube JS changes --- diff --git a/youtube.cgi b/youtube.cgi index 338fac5..1a80bf7 100755 --- a/youtube.cgi +++ b/youtube.cgi @@ -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)