Hi,

Since a few days I am unable to use gpodder on youtube RSS feeds (on 2.10
and GIT): all downloads end up with "Not found" error. As explained in the
bug report, it looks that:

http://www.youtube.com/get_video?

links are no longer working... When sniffing browser behavior, they end up
returning empty data with no header redirect (odd... why is the flash object
still looking for them ?). Instead, the video is downloaded from:

http://tc.v20.cache8.c.youtube.com/videoplayback?

What the patch does is to add few lines to get_real_download_url, in order
to parse fmt_url_map json object sent to Flash. This is a map from fmt to
urls. I kept previous code as a fallback option, but I don't know if this is
really worth it. On my computer gpodder can download youtube videos again
since the patch (from GIT), but this needs to be cross-checked.

Thanks,

Norbert
diff --git a/src/gpodder/youtube.py b/src/gpodder/youtube.py
index 355563c..98fd603 100644
--- a/src/gpodder/youtube.py
+++ b/src/gpodder/youtube.py
@@ -99,6 +99,15 @@ def get_real_download_url(url, preferred_fmt_id=18):
                     fmt_id = id
                     break
 
+        #Bug 1217: Let's parse fmt_url_map object and search for fmt_id
+        r4 = re.compile('.*"fmt_url_map"\:\s+"([^"]+)".*').search(page)
+        for fmt_url_encoded in r4.group(1).split(','):
+            fmt_url = urllib.unquote(fmt_url_encoded).replace('\\/', '/')
+            if int(fmt_url.split('|')[0]) == fmt_id:
+                url = fmt_url.split('|')[1]
+                log('Found url in fmt_url_map: %s (fmt_id=%d)', url, fmt_id)
+                return url
+
         r2 = re.compile('.*"t"\:\s+"([^"]+)".*').search(page)
         if not r2:
             r2 = re.compile('.*&t=([^&]+)').search(page)
_______________________________________________
gpodder-devel mailing list
gpodder-devel@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/gpodder-devel

Reply via email to