Display and Link Your YouTube Favorites in a WordPress Widget
One of the goals of my blog’s reanimation was to link as many of all my different channels spread all over the web (slogan: “You host, I aggregate”) to this site. Thus I wanted a widget that displays and links my recent favorite YouTube videos in a WordPress widget. I couldn’t find one that still worked and since I had wanted to find out how coding a WordPress widget feels for quite some time I decided to write one. Second, I had never messed with the YouTube API before. Turns out, both were drop dead simple and after two hours of fiddling around I finished the YouTubeFavorites WordPress Widget. I used SimplePie as a library to parse the ATOM favorite feed of the Google Data API. Thanks, guys! (Also for saving our lives on some project from hell last year…)
The steps to add the widget to your WordPress (2.8+) installation:
- Get yourself a Google YouTube developer key at http://code.google.com/apis/youtube/dashboard/. There’s no way to fetch a list of your favorite videos without a dev key.
- Download the YouTubeFavorites source zip.
- Unpack the contents into your WP_HOME/wp-content/plugins/widgets folder.
- Create a ‘cache’ folder for SimplePie inside the ‘widgets’ folder, make it writeable (‘chmod 755 cache’, depending on your hoster it might be 777). Adjust the SIMPLEPIE_CACHE constant in YouTubeFavorites.php to point to the cache directory.
- Activate the widget in WordPress’s plugin section.
- Change to the Widget set up section and drag the widget to your sidebar.
- Enter your YouTube user name, your developer key from step 1 and the number of entries to show.
- Check your blog. You’re done.
Kategorie: Allgemein 6 Kommentare »

am 9. Mai 2010 um 03:24 Uhr | #
cool widget, how to add a video thumb for each link ?
am 9. Mai 2010 um 11:55 Uhr | #
The video’s URLs can be retrieved from the feed. I haven’t had time yet to add it. Ask again in a few days.
am 3. November 2010 um 22:27 Uhr | #
Hi there! Any chance that there will be small thumbnails added to the list of favourites? I think that would be highly appreciated
am 29. November 2010 um 07:59 Uhr | #
There is another way to fetch a list of your favorite videos:
http://gdata.youtube.com/feeds/api/users/youryoutubeid/favorites?orderby=updated
am 1. Dezember 2010 um 23:10 Uhr | #
@Jim: cool, thanks for the info. I didn’t know this method existed. I’m pretty sure it wasn’t around when I wrote the plugin. But then, probably even Google doesn’t even know anymore what APIs they have
am 26. Februar 2011 um 21:08 Uhr | #
Great! this will help me in making a permanent youtube video widget for my blog.