]> code.delx.au - youtube-cgi/commitdiff
Support YouTube mobile URLs
authorJames Bunton <jamesbunton@delx.net.au>
Sat, 7 Nov 2020 11:24:04 +0000 (22:24 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Sat, 7 Nov 2020 11:24:04 +0000 (22:24 +1100)
youtube.cgi

index 5c55feb3cdbb1abee93da8834685e7b76dd54193..fb8d96d7c3c3d52131953fbdcc863d08d49fd870 100755 (executable)
@@ -108,7 +108,8 @@ def urlopen(url, offset=None):
 def validate_url(url):
     parsed_url = urllib.parse.urlparse(url)
     scheme_ok = parsed_url.scheme == "https"
-    host_ok = parsed_url.netloc.lstrip("www.") in ["youtube.com", "youtu.be"]
+    host = parsed_url.netloc.lstrip("www.").lstrip("m.")
+    host_ok = host in ["youtube.com", "youtu.be"]
 
     if scheme_ok and host_ok:
         return