Saturday, July 31, 2010

Quick fix for Your gPodder YouTube feeds

YouTube changed something last month, and my YouTube feeds in gPodder started producing "404" errors.
Thomas Perl has already submitted a fix, but who knows when new packages will actually be released. And the Ubuntu package is two versions behind already.

So... If you're not afraid to edit a script file, you can fix your own installation while waiting for the new packages.

Now, I have to admit that I don't know how to edit as "root" using the graphic text editor, gEdit, but hopefully some will add that to the comments.

How I did it:
sudo vi /usr/share/pyshared/gpodder/youtube.py

and in the section that reads


   if r2:
      next = 'http://www.youtube.com/get_video?video_id=' + vid + '&t=' + r2.group(1) + '&fmt=%d' % fmt_id
      log('YouTube link resolved: %s => %s', url, next)
      return next
NOTE: That is only one line although it looks like two line on the web page.

Comment out the line starting with "next" and add these two lines:
    d = {'video_id': vid, 't': r2.group(1), 'fmt': fmt_id}
     next = 'http://www.youtube.com/get_video?video_id=%(video_id)s&t=%(t)s&eurl=&el=&ps=&asv=&fmt=%(fmt)s' % d


The final product should look like:
   if r2:
     # next = 'http://www.youtube.com/get_video?video_id=' + vid + '&t=' + r2.group(1) + '&fmt=%d' % fmt_id
     d = {'video_id': vid, 't': r2.group(1), 'fmt': fmt_id}
      next = 'http://www.youtube.com/get_video?video_id=%(video_id)s&t=%(t)s&eurl=&el=&ps=&asv=&fmt=%(fmt)s' % d
      log('YouTube link resolved: %s => %s', url, next)
      return next
(I added to colors to show the change.)

2 comments:

  1. Hi Lon Koenig
    I have problem you have described here (Ubuntu 10.10) after I followed you suggestion and applied changes, it is not possible to lunch gPodder

    ReplyDelete
  2. Sorry, Usability Book, that patch was for a version back in July of 2010. The problems we saw this February were from from a more major change in YouTube.
    It's back to working for me in regular Ubuntu updates.

    ReplyDelete

Please leave your comment here.