No public Twitter messages.
Jan, 2010
20

YouTube API – XML Feed Ripper

DOWNLOAD SOURCE (*.ZIP)

I created this tool because I could not find a tool that met my needs.  I wanted a simple feed extraction tool that would just post up some dynamic content from YouTube.  It turned into a class which is actually pretty easy to use.

The Class has 3 main functions:

  1. yt_featured();
  2. yt_user();
  3. yt_tag();

Each function uses different arguments to extract the videos you want from the YouTube API. All the functions use your dev ID and a return number to pull in however many videos you want to list. If the return number is left blank it will return all relative videos from the API request string. Otherwise if you ask for 25 and only 23 are available it will return on 23. Simple error checking I know, but its important.

Prep

// first instantiate your class
$yt = new youTube;

Example 1:

$yt->yt_featured("dev_ID", 0);

In this example it pulls all of the featured videos from the “youtube.videos.list_featured” method.

Example 2:

$yt->yt_user("dev_ID", "username", 0);

In this example it pulls all videos from a specific user through the “youtube.videos.list_by_user” method.

Example 3:

$yt->yt_tag("dev_ID", "tag", 0);

In this example it pulls all videos that match a specific tag through the “youtube.videos.list_by_tag” method.

Well thats pretty much it. Very basic probably poorly coded, but I look forward to seeing what the developer community is going to do with it. I hope that everyone keeps me posted on upgrades to my script. I leave it your hands to do with what you want. Just leave me on the credit somewhere as the originator.

DOWNLOAD SOURCE (*.ZIP)

Post to Twitter Tweet This!

This entry was posted on 01.20.2010 at 5:44 am and is filed under Code Bin. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Comments

7 Responses to “YouTube API – XML Feed Ripper”

foreveradog

01.30.2010 | 3:48 am

Very good article well informed ty you for the information. From the guys at Bloggles

03.15.2010 | 8:45 am

Hi,

I can’t download the source – I get a 404 error?

Prinzessin

03.17.2010 | 4:48 pm

useful class but source code is a dead link ….

03.17.2010 | 5:04 pm

Corrected! Source code link is active again.

-Sam

Prinzessin

03.17.2010 | 5:25 pm

Thank you Sam

03.29.2010 | 5:10 pm

Hi.

I have input my api key from youtube but no results are displayed. Just the line:

Videos by tag:

“; $yt->yt_tag(“my_key”, “paintball”, 15 ); ?> ?>

with my_key actually being replaced with my key.

Any help? cheers

sas

04.20.2010 | 7:14 pm

I can not run code help please?

Leave a Reply

Green Web Hosting! This site hosted by DreamHost.