Your Ad Here

Simple YouTube API Class in PHP: Redeaux

Good evening, people of the corn. I am absolutely certain that the grand majority of you have been waiting in the wings for the latest installment of WaxJelly's now famous YouTube API class. Thanks for waiting. In the wings. Wherever they are.

We're starting off slow again on this one, so I'll warn you, all the functionality may not quite be there yet, but this class is destined to continue to improve and become more simple to implement and use. Howeve, at the moment, using this thing is about as easy as falling off a bike.

Let's get started. First, let's talk about what you'll need in order to implement this class.

  • A YouTube API Developer's Key
  • A server running PHP5
  • 20 minutes or so
  • Popcorn
  • Red Hair
  • I could go on, but these stopped being true at bullet point #3

This is an example of what your end result should look like:

WaxJelly YouTube API Class

Now, let's talk about the code to actually make this class work for you. You'll find the following code in the index.php file included in the downloadable package at the end of this post.

Include the youtube class and instantiate it with the object $yt

PHP:
  1. include('youtube.class.php');
  2. $yt = new youtube('YOUR_API_KEY');

...set the amount of results per page, in this case, some arbitrary number like 19 should work. The default is 25, so if you don't set this at all, that's what you'll get

PHP:
  1. $yt->set('per_page', 19);

...get videos by a tag (default search string is "mutemath" in this case ,you can change it to whatever you want.

PHP:
  1. $res = $yt->videos('mutemath');

...build the video list array

PHP:
  1. $video_list = $res['video_list']['video'];

Note that this class sets a whole buncha CONSTANTS that you can use in your script to display lots of data. Here's a list of the constants that are available:

  • YOUTUBE_PREV_PAGE = the current page -1
  • YOUTUBE_NEXT_PAGE = the current page +1
  • YOUTUBE_PAGE = the current page
  • YOUTUBE_TOTAL_PAGES = total pages in the search results
  • YOUTUBE_VIDEO_ID = the currently selected video's unique ID (for display purposes, or in the future, to call youtube's get_details method an retrieve further information, like actual comments by users on this video)
  • YOUTUBE_VIDEO_INDEX = the currently selected video's index in the video_list array (to get all the data from the array)

Later in the file, we loop through our $video_list array and format to display the videos. We do this like so:

...SETUP PAGINATION TO DISPLAY THE NEXT AND PREVIOUS PAGES OF RESULTS, AS WELL AS THE CURRENT PAGE, AND THE TOTAL NUMBER OF PAGES

PHP:
  1. <div class="paginate">
  2. <a href="?page=<?=YOUTUBE_PREV_PAGE ?>"><<prev</a>
  3. :: page <?=YOUTUBE_PAGE ?> of <?=YOUTUBE_TOTAL_PAGES ?> ::
  4. </a><a href="?page=<?=YOUTUBE_NEXT_PAGE ?>">next>></a>
  5. </div>

...BUILD A TABLE OF RESULTS, LOOPING THROUGH 3 COLUMNS ON EACH ROW

HTML:

...loop through each video in the list and display it for design purposes

PHP:
  1. $i = 0;
  2. foreach ($video_list as $k => $v) {

...limit the title's length so it doesn't break the design

PHP:
  1. $title = substr($v['title'], 0, 15) . '...';
  2. echo "<td class='thumb'>
  3. <a href='?video_id={$v['id']}'><img src='{$v['thumbnail_url']}'/></a><br />
  4. <span class='title_short'>{$title}</span><br />
  5. <span class='length_short'>{$v['length_seconds']}</span>
  6. <span class='rating_short'>{$v['rating_avg']} / {$v['rating_count']}</span>
  7. </td>";
  8. $i++;

...only 3 videos per row

PHP:
  1. if ($i == 3) {
  2. $i = 0;
  3. echo '</tr><tr>';
  4. }
  5. }
  6. ?>
  7. </tr>
  8. </table>

Finally, we setup the display on another part of the page to actually play a video we've selected, and display the rest of the data we've gotten on that video (without using the get_details method from the api)

...first, we setup the title of the current video.

PHP:
  1. <h2>
  2. <?=$video_list[YOUTUBE_VIDEO_INDEX]['title'] ?>
  3. </h2>

Next, we setup the flash object call from the standard youtube format, and pass it the value for the video id

PHP:
  1. <object width="425" height="350">
  2. <param name="movie" value="http://www.youtube.com/v/<?=YOUTUBE_VIDEO_ID ?>"></param>
  3. <param name="wmode" value="transparent"></param>
  4. <embed src="http://www.youtube.com/v/<?=YOUTUBE_VIDEO_ID ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
  5. </object>

We can also display all the extra information, like video description, and the total number of views, comments, and the list of tags (all of which are passed to you through our youtube class in the current index of the $video_list array

PHP:
  1. <div id="description">
  2. <?=$video_list[YOUTUBE_VIDEO_INDEX]['description'] ?>
  3. </div>
  4. <div class="stats">Views: <span class="statVal"><?=$video_list[YOUTUBE_VIDEO_INDEX]['view_count'] ?></span><br />
  5. Comments: <span class="statVal"><?=$video_list[YOUTUBE_VIDEO_INDEX]['comment_count'] ?></span><br />
  6. Tags: <span class="statVal"><?=$yt->tags_for_video($video_list[YOUTUBE_VIDEO_INDEX]['tags']) ?></span><br />
  7. </div>

Download the source files here: ZIP | RAR
View a working version HERE

Peace love and peace.
[digg=http://digg.com/programming/WaxJelly_YouTube_API_Class_Redeaux]

274 comments so far

  1. [...] YouTube API Class: Redeaux I am absolutely certain that the grand majority of you have been waiting in the wings for the latest installment of WaxJelly?s now famous YouTube API class. Thanks for waiting. In the wings. Wherever they are. … [...]

  2. [...] View the new post here Posted by Meshach Filed in API's, HTML / CSS, YouTube, PHP / MySQL, Web Sites, Tutorials [...]

  3. [...] View the new post here Posted by Meshach Filed in API's, HTML / CSS, YouTube, PHP / MySQL, Tutorials, Web Sites, Web 2.0 [...]

  4. Killer March 11, 2007 5:49 pm

    I will be implementing this killa feature into our EPK, If I can get it going. Thanks for the great work!

  5. Meshach March 12, 2007 10:17 pm

    Wrock. Let us know when it's in place!

  6. Pham Quang Hung March 14, 2007 5:49 pm

    Hi there,

    I'm a oldschooler using PHP4, waiting for ya for new version for PHP4. A new one for an old one. Is that's cool? Keep up your good work.

    Thanks

  7. Farhan March 15, 2007 4:41 am

    I am gona use this on my site for several pages, just wondering is this a resourse intensive thing ?

    Like would it be better if we cache some stuff to make it faster and only update once a day or something ?

  8. Razvan March 15, 2007 5:10 pm

    hello!
    please tell me if i`m allowed to use adsense on this script. Thank You!

  9. bryan March 15, 2007 9:43 pm

    Pham Quang Hung:
    Yes, we're writing a new version for PHP4 that utilizes domXML, we should be done with it shortly.

    Farhan
    Farhan, we're actually going to be writing a caching feature pretty soon built in to the class, but this is a very resourceful class, and it's using youtube's bandwidth -- as long as you limit the number of results you get (which we do) you'll be fine.

    Razvan
    I don't understand what you're asking exactly, but you can do whatever you want with it.

  10. Razvan March 15, 2007 10:39 pm

    bryan thank you for your answer and sorry about my english. i want to ask you if youtube will not punish me if i use this script with adsense. thank you!

  11. Farhan March 16, 2007 12:44 am

    Thanks for the reply bryan.

    I'll look forward to it :)

  12. Meshach March 16, 2007 4:08 pm

    Razvan, please just include the following somewhere on your implementation of the script and you'll be fine:

    another project by waxjelly

    thnx.

  13. Razvan March 17, 2007 10:56 pm

    hello bryan. i have this error
    Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/creanga/public_html/yt/youtube.class.php on line 36

    This is becouse i dont have php 5 installed on my server? thank you!

  14. Meshach March 18, 2007 1:26 am

    Yes, Razvan. That's exactly the problem. We're working on a php4 version of this script, but until then, we're only able to support php5.We also plan to build in an error-check at the beginning of the script to tell you what you've got installed, but for now, we just have to trust you to know how to do that.

  15. Brett Johnson March 18, 2007 5:48 pm

    Is there an easy way to make it display the videos of specified user instead of tag?

  16. bryan March 18, 2007 6:32 pm

    Brett, it's currently restricted to tags only, we're about to release a deluxe version along with PHP4 compatability, give it a little time. Sorry about that.

  17. Razvan March 18, 2007 8:21 pm

    Meshach thank you for your answer

  18. Salim March 23, 2007 12:46 pm

    Hi,

    very nice script, results on your website is great !! But i have a little problem ... i'm using php4 ;-(

    I read taht you were working on a php4 version.. Do you have some news about it ? I'm really waiting for it ..

    Moreover, i read somewhere differences between php4 and php5. Can you explain me shortly what will be the changes you are going to do ?

    -> public word
    -> constructor ...

    Thanks in advance,

    Salim

  19. bryan March 23, 2007 8:00 pm

    Salim, this really should be an article but a brief explanation is the packages that come pre-installed with PHP5 differ from PHP4, such as SimpleXML which is the package you need to run this script.

    the public/private/protected keywords for class properties were introduced. PHP5 was really a big jump towards object-oriented progamming.

    constructor's in PHP4 used to be the name of the class itself, so for example:
    class youtube {
    function youtube() {
    // this would be the constructor
    }
    }

    now you can specify in PHP5
    class youtube {
    __constructor($var) {

    }
    }
    $youtube = new youtube('something');

    etc.

  20. Emulatore March 25, 2007 12:37 pm

    Hi i've notice that the per_page variable stop working when you made searchs with spaces between the words, like: robin hood

    so i've changed the line 129 of youtube.class.php

    old line:
    youtube::modify_call($method . '&dev_id=' . $this->config['api_key'] . $this->tag);

    new line:
    youtube::modify_call($method . '&per_page='.$this->config['per_page'].'&dev_id=' . $this->config['api_key'] . $this->tag);

  21. paidee72 March 29, 2007 10:12 am

    Hi,

    Very nice plug-in. Is PHP4 there yet?

  22. vaibhav March 30, 2007 12:14 pm

    Is this script available for php4 version?

  23. vaibhav March 30, 2007 1:38 pm

    Very good script.

    When php4 version will be available?

  24. Meshach March 30, 2007 9:31 pm

    Vaibhav... soon. We promise.

    Emulatore... Thanks for the bug fix. We'll get that implemented as soon as we can.

  25. Meshach March 30, 2007 9:37 pm

    Coming soon... "PHP4 vs PHP5: what's the diff, and why should you care?"

  26. Postnip March 30, 2007 9:56 pm

    hi, i might've founded an error

    search for rocket and you will see that there are 1175 pages avaible: http://waxjelly.com/dev_code/youtube_api/?tag=rocket

    go to page 1170 and there we have errors:

    http://waxjelly.com/dev_code/youtube_api/?page=1170&tag=rocket

    the errors i got were:

    Notice: Undefined index: video_list in /home/11241/domains/waxjelly.com/html/dev_code/youtube_api/youtube.class.php on line 193

    Notice: Undefined index: video_list in /home/11241/domains/waxjelly.com/html/dev_code/youtube_api/youtube.class.php on line 205

    Notice: Undefined index: video_list in /home/11241/domains/waxjelly.com/html/dev_code/youtube_api/youtube.class.php on line 206

    Notice: Undefined index: video_list in /home/11241/domains/waxjelly.com/html/dev_code/youtube_api/index.php on line 13

    Warning: Invalid argument supplied for foreach() in /home/11241/domains/waxjelly.com/html/dev_code/youtube_api/index.php on line 37

  27. Meshach March 31, 2007 2:57 pm

    We do actually know about this bug. It's just telling you that there is no default tag being set. We've fixed this in the new class, coming soon.

    In other news, it helps us out tremendously if you digg our stuff (hint, hint).

  28. d4n4b April 5, 2007 4:50 pm

    Hi!
    Thanks for the great script!
    I'm calling it like by doing this:

    $yt = new youtube();
    $res = $yt->videos($artist)
    ..
    I then display with:

    ..

    every so often I get the following error:

    Warning: file_get_contents(http://www.youtube.com/api2_rest?method=youtube.videos.list_by_tag&dev_id=zZsCGc6qzGY&tag=Andrea Bocelli&page=1&per_page=4) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 500 Server Error in /vhost/home/test/test/var/www/html/beta/test/search/youtube/youtube.class.php5 on line 173

    Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /vhost/home/test/test/var/www/html/beta/test/search/youtube/youtube.class.php5:174 Stack trace: #0 /vhost/home/test/test/var/www/html/beta/test/search/youtube/youtube.class.php5(174): SimpleXMLElement->__construct('') #1 /vhost/home/test/test/var/www/html/beta/test/search/youtube/youtube.class.php5(139): youtube->display() #2 /vhost/home/test/test/var/www/html/beta/test/client.php5(142): youtube->videos('Andrea Bocelli') #3 {main} thrown in /vhost/home/test/test/var/www/html/beta/test/search/youtube/youtube.class.php5 on line 174

    Any suggestions on why this happens are greatly appreciated - it happens for varying $artist values..

    p.s: I'm trying to get only 1 return value -
    and I have the per_page set to 1 or 2 - not sure it works with 1 actually..

    what's the best way to do that and avoid my error? i.e. only return 1 hit?

    Thanks!

  29. bruce P April 6, 2007 9:52 am

    Fantastic job! It works great.
    One thing tho, I tried setting paginate to show 9 vids, it does on first page but other pages revert to 20.
    Also when I click on a video to view it on a page past page 1, I can waych it but pages revert back to page 1.

    Any fix or did I do something wrong?

    Thanks!

  30. MMC April 10, 2007 4:38 am

    waxjelly thinkin build a ajax version of this class?

  31. adige April 11, 2007 7:14 am

    Your sourcecode files have error, your sample url working.

    Im install this files, when i select any video, page refreshing and going to page 1, why ?

  32. Jason April 14, 2007 9:29 pm

    I wrote a version for PHP4. It has the following usage:

    $yt = new YouTube($dev_id);
    $title = $yt->getVideoTitle('FoSdgbI6PKs');
    $img_urlk = $yt->getVideoThumbnail('FoSdgbI6PKs');
    unset($yt);

    I don't have it posted live on any server, but if you want it, free feel to email me at info [at] fantasyhiphop [dot] com

  33. postnip April 15, 2007 4:34 am

    youtube.class.php has NO troubles looking for 1 word at a time, but when looking for more it crashes.

    I've just replaced the spaces with "+" using this in the part (line 123, i guess):

    //YOU TUBE VIDEO METHODS

    case BY_TAG:
    if (isset($_GET['tag']))
    {
    $tag_nuevo=str_replace(" ","+",$_GET['tag']);
    $this->tag = '&tag=' . $tag_nuevo;
    }

    that's it!!
    BUT it crashes AGAIN when i look for
    "axl rose usa tour 1990"

    showing the error:
    Fatal error: Cannot use string offset as an array in /home/website/public_html/youtube.class.php on line 197

    and I'm still trying to discover the reason.

    That's all folks, i hope i can help fixing more of this great source of code. ciao

  34. Corey April 29, 2007 7:14 am

    Haven't used it, but I feel compelled to point out a simple trick. Instead of determining rows via incrementing i and checking if it's equal to the number of columns desired and then resetting it, you can use a for loop and do this instead:

    if (!$i % 3) echo "";

    You can also do something like this if it fits what you need (it'll automatically create a new td for each i unless i%3==0, then it will close the td, close the tr, and open a new row and td):

    echo (!$i % 3) ? "" : "";

    Hope someone finds this useful.

  35. Ian May 14, 2007 9:39 am

    Great script which worked perfectly on my local dev setup but collapsed when uploaded to Dreamhost. Fix is below...

    If you are getting message "Warning: fopen(): URL file-access is disabled in the server configuration", then allow_url_fopen is set to off in php_ini.

    An alternative is to use the CURL extension (which you may need to install). Works a treat.

    CHANGE THIS

    // SEND REQUEST
    $this->return = file_get_contents(youtube::return_call());

    TO THIS

    // SEND REQUEST
    if(function_exists("curl_init")){
    $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL,youtube::return_call());
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    ob_start();
    curl_exec ($ch);
    curl_close ($ch);
    $string = ob_get_contents();
    ob_end_clean();
    $this->return = $string;
    } else {
    $this->return =file_get_contents(youtube::return_call());
    }
    //

  36. Koie May 15, 2007 2:59 pm

    Not english bug
    get error if Tag or search none english.

  37. ShinZaiaku May 16, 2007 4:53 pm

    I would like to have this in a php4 version.

  38. bleucube May 25, 2007 5:00 pm

    Hey Peeps,

    I've been looking for a script like this for abit. However needed it in PHP4 so I converted it over and works pretty good. Now looking to clean up code and add a few features. I've radically changed the design and some of the code. Let me know what you think:

    http://zombiesocial.com

  39. Sam May 29, 2007 9:29 am

    I have a question, if someone can help me with it. This is a great script, but it does everything on the index page, what about the idea that, by clicking on some video, it takes to the single page and shows the video there?
    something like
    http://xyz.com/showvideo.php?video_id=xxx
    can someone help with it?

  40. Bob May 31, 2007 1:28 pm

    Hey,

    Has anybody fixed the multiple search term bug? If you type two words in the tag search or in the code itself, it crashes. You can get around it by using a '+' between each term. This works great until you goto 'prev' or 'next'. It then crashes again.

    It also crashes if you try it in the demo here :-

    http://waxjelly.com/dev_code/youtube_api/?tag=mutemath

    I have tried the fix by postnip above but that returns this error

    Parse error: syntax error, unexpected T_STRING in /youtube.class.php on line 126

    Any ideas anybody?

    Thanks

  41. Bob May 31, 2007 1:44 pm

    Hello,

    Ignore the above message. I had used copy-paste of the code in postnips' message. After going through and changing the ' " etc it worked just fine!

    Thanks

  42. bleucube June 4, 2007 4:01 pm

    Number in left had corner. Does anybody know why when you click on a link it displays it's # in the top left corner? Using IE7. Does it on demo and on my site too.

    Thanks!

  43. Thom June 6, 2007 1:38 am

    Hi, is it possible to get this to work on a Group instead on searching a tag?

  44. marcelo antelo June 6, 2007 9:09 pm

    And what about that php4 version? Does anyone know where to go to download it???

  45. Pamps June 7, 2007 12:36 am

    Bob,

    Can u pls post your solution here. I try to fix the multi-keyword search with no success. Ty

  46. PHP4 June 8, 2007 6:37 am

    So has the php4 project been given up on? Does anyone have an update?

  47. David Nilsson June 12, 2007 7:35 am

    To fix the problem with errors on multiple word searches just do this:
    1. Open youtube.class.php
    2. Replace line 125 with "$this->tag = '&tag=' . str_replace(" ", "+", $_GET['tag']);" (without first and last ")
    3. Done

    You can try it out at http://www.david.nu/youtube/

    Waxjelly: Cool script! Will get in handy on my new project... Will let you know when it's done!

  48. Pamps June 14, 2007 8:27 am

    Ty David,

    it works this update but all keywords u input have to be in youtube database (must be valid tags) otherwise u get an error, i mean, try the keyword "m4m4" for example. It will give the 193 line error.

    Anyway i am trying to use it in a different way but have the problem of youtube only send you information for the first 1000 matches per API call by tag. I mean, the word "car" will return 19142 pages but you know that page 41 will give error ( assuming the 25 records per pag ).

    Is there anyway we can only limit the ( prev and next ) to show only until pag 40. As i am not a coder this seems like a complex thing to do and i do not know where on the youtube.class.php where to tune.

    Ty for any tip and help,
    Pedro

  49. iiemii0 June 15, 2007 9:02 am

    to my it appears to me east Notice error: Undefined index: in C:\AppServ\www\youtube.api\index.php on line 59 Notice: Undefined index: in C:\AppServ\www\youtube.api\index.php on line 66 Views: Notice: Undefined index: in C:\AppServ\www\youtube.api\index.php on line 68 Comments: Notice: Undefined index: in C:\AppServ\www\youtube.api\index.php on line 69 Tags: Notice: Undefined index: in C:\AppServ\www\youtube.api\index.php on line 70 So that?

  50. steelersyndicate June 16, 2007 12:51 pm

    When I do the above fix for multiple search:

    To fix the problem with errors on multiple word searches just do this:
    1. Open youtube.class.php
    2. Replace line 125 with “$this->tag = ‘&tag=’ . str_replace(” “, “+”, $_GET[’tag’]);” (without first and last “)
    3. Done

    I am getting this error:

    Parse error: syntax error, unexpected '=' in /home/public_html/youtube.class.php on line 125

    any idea?

  51. steelersyndicate June 16, 2007 1:00 pm

    Forget it, I fixed it. The cut and paste created incorrect ' and "

    $this->tag = '&tag='. str_replace(" ", "+", $_GET['tag']);

  52. Johno June 16, 2007 4:24 pm

    Great script

    any idea how to solve these two problems

    in ie explorer 7 when you click on a thumbanil for some reason the css background gets unread (the demon here does it as well) just the background it seems?? it works all fine in firefox

    Now one solution is to bring the include in the index into the body, if you want the script to work as is this is a fix for ie.

    However and please help! a main wish for me is title on each page, so how can i get the title of the movie in the head and show on top of page, if I move the include out of where it is now I can no longer get the code to provide an auto title.

    i have tried the

  53. ShinZaiaku June 17, 2007 7:34 pm

    Anyone have this for PHP4 yet?

  54. bleucube June 18, 2007 8:15 pm

    Johno - I found the way to correct this is to align the DIV to center. That will fix it.

  55. Gonzalo Jimenez June 20, 2007 1:08 am

    Excelent!,

    now, u know how can i upload videos?

  56. Pamps June 20, 2007 1:54 pm

    ...any help for how i can limit the pagination in order to show only the 1000 entries that youtube API limits.

    "I mean, the word “car” will return 19142 pages but you know that page 41 will give error ( assuming the 25 records per pag )."

    php help pls?
    ty
    Pedro

  57. johno June 22, 2007 10:35 pm

    Thanks bleucube

    Anyone know the fix for pamps?

    Also when you click a thumbnail the page reverts back to the original thumbnails, is there not a way of keeping at the new page thumbs?

  58. Ann June 23, 2007 6:29 pm

    @Bleucube: you've made such a nice solution on your zombiecentral page - any chance you will share your wisdom with the many of us longing to make this work in PHP4? I've been trying to cludge something together using bits and pieces from various sources and it's so close but no cigar. Even if it isn't perfect, it would probably help us a whole lot! Thanks in advance!

  59. bleucube June 24, 2007 4:12 am

    Send me an email bleucube @ gmail.com for php4 version that includes most fixes list here and additional functions.

  60. MrKryptic June 27, 2007 1:32 pm

    Sweet!!! This is exactly what I've been looking for :D Thanks for this!!

  61. MrKryptic June 27, 2007 1:52 pm

    One other thing, the script gives errors if the search term has spaces. Editing this line of code fixed it:
    public function return_call() {
    /*this line*/ return str_replace(" ", "%20", $this->api_call);
    }

  62. bryan June 28, 2007 5:30 pm

    You might want to replace that with $clean = urlencode($this->api_call);

  63. Shin Zaiaku June 28, 2007 10:38 pm

    MrKryptic are you using the php5 or original version? So far I haven't came across any problems with spaces.

  64. minnymoo June 30, 2007 9:00 pm

    Any idea how to correct the script to produce special language characters. like the fada in gaelic or the german umlet.á é í ó ú
    example try the tag gaeilge on the demo and then on youtube
    http://waxjelly.com/dev_code/youtube_api/?tag=gaeilge

    http://youtube.com/results?search_query=gaeilge&search=

    all the special characters as it is now come out as code

    Anyonw know how to fix it so it comes out as ordinary text

  65. minnymoo June 30, 2007 9:21 pm

    also the page is never ending

    example it may say page 1 of 3 but you can keep clicking indefinate but page is same. search engines may not list any site that repeats identical content.

  66. Shin Zaiaku July 1, 2007 12:45 am

    Damn I didn't even notice that pages will continue for ever. Even if you have only 1 page of results it will list list pages constantly. I think SE's will classify them as duplicate content.

  67. johno July 1, 2007 12:15 pm

    search engines (google) will put the pages into supplemental at best, as the script stands that is definate.
    anyone know how to make the script produce clean html for special characters in languages? things like á é come out as bad code right now.
    i will work on the pages and answers if someone can do the above.

  68. Zaiaku July 3, 2007 8:28 pm

    I worked with the scrip alot more. Was able to do some customizing on it so far on 1 of my sites. Even if the same video is looked at the page has different text so that it doesn't have duplicate pages. Also added SEO urls and dynamic page titles and stuff like that. Was also able to protect the script some so that I can put duplicate copies up on different domains and servers. That's for this script.

  69. johno July 3, 2007 10:04 pm

    Sounds very good Zaiaku

    Can you share these updates?

  70. bryan July 5, 2007 7:39 pm

    You guys :) We're going to revise the PHP5 version to be as bug-free as possible from all of your comments, and release the first version of the PHP4 YouTube API. Yes we know we've said that 3, or 4 times, but we realy put a lot of TLC into this next release.

    Stay tuned.

  71. johno July 5, 2007 8:58 pm

    Sounds great Bryan.

    Is it possible for in between the wothwhile wait to get the corrected code to limit the pages. so if it says 1 of 6 then only 6 pages will be available.

  72. Zaiaku July 6, 2007 12:45 pm

    Maybe I should wait to you all release the updated versions to make sure the no confliccs. Then include the changes I made.

  73. bryan July 6, 2007 2:41 pm

    Zaiaku, just give me a list of the stuff you modified and I'll be sure to note your changes when we finalize the dev work.

  74. Zaiaku July 6, 2007 9:32 pm

    The 3 main ones where:

    Video Title is page title
    Video Description is page description
    SEO urls

    I was able to intergrate your script with some forum scripts but I don't use many of them. Just vbulletin and phpbb. I only did that so people could post them into forum posts.

  75. Farhan July 8, 2007 4:49 am

    Hey do you guys have any time frame for the next release ?

  76. rick July 8, 2007 11:11 am

    Can you please post the code to make

    This:
    http://www.mysite.com/youtube/?video_id=MDvlbmI1Q6I

    To this:
    http://www.mysite.com/youtube/?video_id=MDvlbmI1Q6I&tag=mytag&page=1

    when i click on the video my link show only the ?video_id

    Can you help me to show &tag &page?

    Thanks
    Nice code

  77. rick July 8, 2007 11:24 am

    Can anyone send me the full code have on this link?
    http://waxjelly.com/dev_code/youtube_api/

    The download link is not the same have here

  78. Zaiaku July 8, 2007 12:29 pm

    The updating the code. Give them time to post a new link with all the fixes.

  79. gavetips July 8, 2007 11:42 pm

    I found a quick and dirty fix to make the script output special characters like æ, ø, ë, é etc.

    Around line 96, just before the code "return $array;", add these two lines of code:
    $array["title"]=utf8_decode($array["title"]);
    $array["description"]=utf8_decode($array["description"]);

  80. rick July 8, 2007 11:45 pm

    To str_replace work on my site i have changed

    This:
    $this->tag = ‘&tag=’ . str_replace(” “, “+”, $_GET[’tag’]);

    To:
    $this->tag = '&tag=' . str_replace(" ", "+", $_GET['tag']);

  81. rick July 8, 2007 11:49 pm

    nice one gavetips
    thank

    And sorry to my post above....here have str_replace to LOL

  82. rick July 8, 2007 11:51 pm

    If you put this code before ...not work

    Place the code ABOVE “return $array;”

  83. Zaiaku July 9, 2007 12:00 am

    There's a diffrent between those too lines?

  84. johno July 9, 2007 2:43 am

    Well done gavetips, works. thank you.

    anyone know how to limit the thumb page search so it sticks to the actual pages available, so for example 1 0f 6 has only 6 viewable pages.

  85. alex July 9, 2007 5:59 am

    Can anyone send the code of video_id=***&tag=***&page=***

    The demo is not the same as the zip file

  86. mauro July 9, 2007 6:06 am

    [09-Jul-2007 06:01:49] PHP Notice: Undefined index: title in youtube.class.php on line 93

    [09-Jul-2007 06:01:49] PHP Notice: Undefined index: description in youtube.class.php on line 94

    [09-Jul-2007 06:01:49] PHP Notice: Undefined index: tag in index.php on line 91

    [09-Jul-2007 06:01:49] PHP Notice: Undefined index: in index.php on line 126

    Bug?
    No fixes?

  87. Huan July 9, 2007 11:03 am

    YEs its very buged
    When i search for "u2" its show the videos of "u2" , but when i click on video its get php errors "undefined index" and its back to public function videos($data = 'xxx', $method = BY_TAG) {

  88. Zaiaku July 9, 2007 1:37 pm

    they will be releasing a new version with all the bug fixes. There will be a new story post about it.

  89. jhon July 9, 2007 5:53 pm

    hi, this is a nice script thnx. we are waiting for your new version.

  90. Morpheu July 10, 2007 2:54 am

    If you post the incomplete code maybe i can increase the code to work fine.

  91. Zaiaku July 10, 2007 3:34 am

    You'll proably have to get someone to uploa the old version to do that.

  92. mauro July 10, 2007 7:22 am

    No updates?

    when you release the next version?

  93. Morpheu July 10, 2007 12:34 pm

    Some tips for all...

    When the user put on search letter like ÇÁã etc...the script crash......To fix it go to index.php

    Find:

    And put ABOVE:

    -1))
    return true;
    else
    return false;
    }
    //-->

    Find:

    Change to:

  94. Morpheu July 10, 2007 12:34 pm

    Sorry....my code don´t appear here...

  95. Zaiaku July 10, 2007 4:12 pm

    Not that anyone has used charcters like that on my pages but would be nice to cover all basis just incase.

  96. Morpheu July 10, 2007 5:06 pm

    When you search a video and this video come with that title format:

    the_video_is_very_long_name_with_underlines

    your page crash...

    to fix it open youtube.class.php and find:

    //Add a simple element
    $array[$key] = $child;
    }
    $fils++;
    }

    if($fils==0) {
    return (string)$xml;
    }

    And put below

    $array['title']=str_replace("_", " ",($array['title']));

  97. Zaiaku July 11, 2007 3:58 am

    This seems to be only for the PHP5 version. I haven't came across this issue with the PHP4 but good fine. Bryan did state that he will do his best to include all fixes in the next version.

  98. joanilson July 11, 2007 6:57 am

    waiting for the "video_id=***&tag=***&page=***" code... i've tried to get it by myself, but i couldn't get it right....

  99. Morpheu July 11, 2007 8:06 am

    Ok..its not finaly code but you can use provisory..

    On index.php find on line 41:

    '?video_id={$v['id']}'

    And change to:

    '?video_id={$v['id']}&tag=".str_replace(" ", "+", $_GET['tag'])."&page=".YOUTUBE_PAGE."'

    But don´t forget to access the link with :

    ?tag=xxx

    http://www.yoursite.com/thesource/?tag=xxx

    Because im waiting for the finaly source to.

  100. Morpheu July 11, 2007 8:10 am

    and 1 more tip

    On index.php find on line 26:

    Change to:

    ">

    Its get the tag every page when you click on video and stay on the same tag!

  101. Morpheu July 11, 2007 8:12 am

    God....Sorry...i can´t post codes here.....because here have strip_tags lol

  102. Morpheu July 11, 2007 8:24 am
  103. Dana July 11, 2007 2:28 pm

    I found a new site and i think they are using the script. Maybe they will help some of you with a few issues. site: http://www.ThisAintIt.com go to their video link

    thanks

    Dana

  104. Pixuqkkk July 11, 2007 9:04 pm

    interesting thank you...
    car deal enterprise rent alaska fishing lodge for sale

  105. Zaiaku July 12, 2007 4:01 am

    Dana that uses a totally different script.

  106. joanilson July 12, 2007 5:35 am

    Morpheu: Thanks, it's wrong, but now I got, the correct is:

    This:
    ‘?video_id={$v[’id’]}’

    Change to this:
    '?video_id={$v['id']}&tag={$_GET['tag']}&page={$_GET['page']}'

    worked fine here, unless if you use 2 words tag

  107. joanilson July 12, 2007 8:22 am

    another bug of my code, it doesn't work on index... until you click on next page..

  108. Dana July 12, 2007 3:26 pm

    when you do a search http://www.thisaintitvideos.com/search.php?tag=test it uses the same script. The source code is the exact same as this one.

    thanks

  109. Zaiaku July 12, 2007 3:54 pm

    Its not the same script trust me. It uses a similar method for getting the video but its a diffrent script all together.

    One big different is that Brian script is only using 1 page. And really only uses 2 files. The script that site is using is the same as topvideoshare version 1.5. That's why the search page is search.php and the video page is watch.php

  110. Morpheu July 14, 2007 11:28 pm

    No updates?:

  111. tweety July 15, 2007 12:12 pm

    is it possible to get code for page numbering problems now.

  112. Zaiaku July 15, 2007 1:49 pm

    I'm not sure if Bryan is addressing that or not in the next version. There will be alot of fixes implemented. Where ever he leaves off at someone else will add their on fixes after the new version.

  113. tweety July 17, 2007 1:48 am

    OK thanks for the info of future updates.

    Has anyone got the pagination fix now?

  114. rob July 19, 2007 11:19 pm

    Hi Wax can you send me a working version or the latest version I would gladly appreciate it.

  115. daved July 25, 2007 8:53 pm

    i cant get it work this, could anyone did it?
    thanks

  116. Zaiaku July 25, 2007 10:28 pm

    Rob,
    The pagination will be fixed in the next version.

    Daved,
    If you using the older one, make sure you running it on a PHP5 server. Also may need to checc you server settings. It does work.

  117. dave July 26, 2007 10:12 pm

    hi guys
    pls can anybody copy paste their youtube.class (fixed one)here as im having that multible search problem and i dont understand from php at all.
    people explained above and did what they said but still having the problem.
    thanks you very much indeed

  118. Pamps July 27, 2007 11:38 am

    hi,
    Still struggling against the Fatal error: Cannot use string offset as an array in /home/ppamps/public_html/youtube.class.php on line 197 when you serach using a word like : uferhfieehi or some tag tht youtube does not have. I suppose is this....

    Has anyone been able to solve this?

    Ty a lot,
    Pamps

  119. Zaiaku July 27, 2007 4:48 pm

    Line 197 ???
    That's a comment line for me. Post what it shows are your line 197. Most likely it does come from when search for a video that youtube doesn't a tag words or discription that has that word.

  120. jogger July 27, 2007 8:58 pm

    is new script coming out? if yes when will this be?

  121. dave July 28, 2007 4:50 pm

    """"hi guys
    pls can anybody copy paste their youtube.class (fixed one)here as im having that multible search problem and i dont understand from php at all.
    people explained above and did what they said but still having the problem.
    thanks you very much indeed"""

    anybody will help ?

  122. Zaiaku July 28, 2007 8:52 pm

    Dave, you will just have to apply the fix for it. I wouldn't mind posting it but I cusomize mine so much it has alotof extra stuff on it.

  123. dave July 29, 2007 5:41 pm

    zaiaku
    all i need this multiple search problem to be fixed.
    if necessary im ready to pay for it.
    i don't understand why site admin is not replacing the zip with fixed one as i see that demo is working great now.
    if anybody wanna send the fixed script.
    my email-msn:
    admiral_alican @ hotmail .com
    thanks

  124. [...] youtube'dan ceken gelistirmeye acik bir video scripti yapan ve yayinlayan Simple YouTube API Class in PHP: Redeaux « WaxJelly demo Youtube izle indir download RapidShare: 1-Click Webhosting tek yapmaniz gereken rar i acip [...]

  125. Serdar July 31, 2007 10:57 pm

    THANKS ,THIS, *SCRİPT, *PHP, 4, *VERSİYONU, WHEN, GET OUT, THANKS,

  126. Carlton Dickson August 9, 2007 8:02 pm

    Anyone managed to integrate this with code igniter at all?

  127. johno August 9, 2007 9:36 pm

    Please can someone tell me how to fix the pagination problem.
    the update says
    [quote]Page numbers are inaccurate, and don’t allow you to go to the last page because of numbering issues

    * This was caused by YouTube displaying x amount of videos per page, and us/you having a different number of results per page, for example compared to YouTube’s 20 results per page. So while there would be 3149 pages, there’s really not that many because you either have MORE videos per page than YouTube does, or you have way less, either way this has been fixed by dividing the total number of videos by the amount of videos you want per page.
    [/quote]

    any fix please.

  128. Pelle August 10, 2007 9:55 am

    I am trying to debug the class now.
    When the result from youtube is only one video I get an empty result and when the result is empty I get an error.
    Can someone please tell me what this line does:
    return (string)$xml;

    I am probably to stupid, but will this line return?

  129. Jon August 12, 2007 6:16 pm

    ***Problems with pages***

    I am working on fixing this. I found the problem and the problem is youtube doesnt service more than a thousand videos per search. So if you have 20 per page you can only go to page 50. At 51 it will error out. So the scripting that Im going to work on will limit the results to 1000 per search. So keep that in mind on how many you choose to have on your page.

  130. Zaiaku August 13, 2007 12:55 am

    Nice find. 1000 search limit should be easy to cap off. Thanks for the find.

  131. johno August 15, 2007 10:44 pm

    Anybody managed to get the pagination solved?

  132. tommy August 20, 2007 4:22 am

    Can someone figure out how to take the youtube embedd code and replace it with your own site? At the same time displaying for others to copy and paste?

  133. tommy August 20, 2007 4:23 am

    What is te final fix for the multie word search issue? I can't get it to work!

  134. Zaiaku August 21, 2007 12:15 am

    I'm mostly using the php4 version. I have't done much work with php5 version so can't help you fix that.

  135. Jereme Hancock August 22, 2007 4:25 am

    I love this script.

    Is there anyway to do the same thing with GodTube.com?

    Jereme

  136. YouTube Video Grabber August 28, 2007 2:28 pm

    I managed to get the script working bug free and it compliments my youtube video downloader script now! Great script...love it.

  137. Manele August 30, 2007 8:26 pm

    i love it :) thank you!

  138. Nuar September 2, 2007 3:49 pm

    Hi every one where can I get the script?

    Thank you

  139. Romeo Khan September 18, 2007 4:06 am

    I need the coding to display related video in the video player page ajax

    any idea how to add comment system?

    Please help

  140. Timyqpop September 25, 2007 11:20 am

    big gallery pizza sausage
    big gallery pizza sausage

  141. Necqapop September 29, 2007 8:25 am

    injecting valium
    injecting valium

  142. Joseph October 3, 2007 9:39 am

    hi Meshach,
    i am facing these errors plz guide me where n wht i am missing ?

    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/xxx/public_html/videos/wp-admin/admin-header.php:16) in /home/xxx/public_html/videos/wp-content/plugins/youtube.class.php on line 5

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/xxx/public_html/videos/wp-admin/admin-header.php:16) in /home/xxx/public_html/videos/wp-content/plugins/youtube.class.php on line 5

    Notice: Use of undefined constant p0XIq - assumed 'p0XIq' in /home/xxx/public_html/videos/wp-content/plugins/index.php on line 4

    Notice: Use of undefined constant UuXeE - assumed 'UuXeE' in /home/xxx/public_html/videos/wp-content/plugins/index.php on line 4

    Notice: Undefined index: video_list in /home/xxx/public_html/videos/wp-content/plugins/youtube.class.php on line 193

    Notice: Undefined index: video_list in /home/xxx/public_html/videos/wp-content/plugins/youtube.class.php on line 205

    Notice: Undefined index: video_list in /home/xxx/public_html/videos/wp-content/plugins/youtube.class.php on line 206

    Notice: Undefined index: video_list in /home/xxx/public_html/videos/wp-content/plugins/index.php on line 13

  143. janangull October 10, 2007 2:34 am

    Where do i get a youtube API developer key, i can see a developer ID in "Developer profile" but it is giving me error

  144. janangull October 11, 2007 4:41 am

    help
    someone plz make a reply

    one thing more where to put these 2 files,plz let me know their paths. where to put index n youtube.class.php

  145. Sivoyxox October 13, 2007 3:04 am

    best diet for gout
    best diet for gout

  146. aleandro October 13, 2007 5:37 am

    this script is incredible buggy!

  147. Mitesh Tandel October 16, 2007 11:05 am

    Your youtube class is very good.

    I have a little problem with that,
    Whenever i m running that i have this errors on page,

    Warning: file_get_contents(http://www.youtube.com/api2_rest?method=youtube.videos.list_by_user&dev_id=gvpEFxUoyP0&user=VideoVolunteers&page=1&per_page=25) [function.file-get-contents]: failed to open stream: Permission denied in /home/u5/jessicam/ch19.org/html/wp-content/themes/default/youtube/youtube.class.php on line 209

    Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/u5/jessicam/ch19.org/html/wp-content/themes/default/youtube/youtube.class.php:217 Stack trace: #0 /home/u5/jessicam/ch19.org/html/wp-content/themes/default/youtube/youtube.class.php(217): SimpleXMLElement->__construct('') #1 /home/u5/jessicam/ch19.org/html/wp-content/themes/default/youtube/youtube.class.php(159): youtube->display() #2 /home/u5/jessicam/ch19.org/html/wp-content/themes/default/youtube/index.php(190): youtube->videos('', 'list_by_user') #3 /home/u5/jessicam/ch19.org/html/wp-content/themes/default/category-3.php(9): include_once('/home/u5/jessic...') #4 /home/u5/jessicam/ch19.org/html/wp-includes/template-loader.php(36): include('/home/u5/jessic...') #5 /home/u5/jessicam/ch19.org/html/wp-blog-header.php(21): require_once('/home/u5/jessic...') #6 /home/u5/jessicam/ch19.org/html/index.php(4): require('/home/u5/jessic...') #7 {main} thrown in /home/u5/jessicam/ch19.org/html/wp-content/themes/default/youtube/youtube.class.php on line 217

    can anybody help with that?
    thank you

  148. janangull October 16, 2007 7:33 pm

    aleandro no it is not buggy, as i have seen lots of sites running this addon on web, but the script maker is not coming online thats why we are still hanging in air

  149. Kjcqipop October 16, 2007 7:59 pm

    okinawa diet food
    okinawa diet food

  150. bleucube October 17, 2007 7:56 pm

    You can all download my bug free PHP4 version at http://ooglester.com/ooglester.zip

    Enjoy

  151. Zaiaku October 18, 2007 8:14 pm

    nice share by bluecube

  152. Kantreddi October 20, 2007 6:13 am

    This is very helpful. Any plans for new Youtube API too?

  153. Robert October 20, 2007 10:13 pm

    Hy, what about the php 4 version? Please, can you tell us something?.. thanks...

  154. Ximyapop October 22, 2007 8:54 pm

    enterprise car rental los angeles
    enterprise car rental los angeles

  155. janangull October 25, 2007 4:33 am

    bleucube, you just did it man, bravo nice script

  156. bleucube October 25, 2007 10:46 am

    I have new PHP demo up. I stripped the tagcloud beause of all the spam. Should work flawlessfly. This is another example on easy it is to configure the script.

    Demo: http://ooglester.com/demo2

    Download: http://ooglester.com/demo2/demo2.zip

    Cheers!

  157. FAbOquon October 31, 2007 1:23 am

    diet phentemine pill
    diet phentemine pill

  158. hart November 2, 2007 11:38 am

    bleucube, you have not got it bugfree. your pagination is still endless.

  159. ThC November 2, 2007 7:30 pm

    This is probably a simple question, but I just can't find the answer, I 'm using the script for php4 from bleucube and on after a user searched for videos, I want a sentence in which I repeat what the user searched for. What is the variable I should echo? $tag and $tags and many others I tried are all undefined?!

  160. Jereme November 4, 2007 3:17 pm

    Love the script.

    I am using bleucube's version and it works great. I worked around the 1000 limit by putting 99 videos per page and wrapping them in a scrollable div. For my purposes this works great.

    Now the only issue I have left is this error.
    Fatal error: Cannot use string offset as an array in /home/whatwou/public_html/uketube/youtube.class.php on line 486

    I get it whenever I search for tags that aren't in the youtube database. If I could get this error fixed then I could set the script up to hide all php errors and it would just show 0 results when the tag is not available.

    Anyone have any idea how I can fix this issue. I am so close to having this working the way I want it. :)

    Check it out here.
    http://www.whatwouldjesusdownload.com/uketube/index.php

    Thanks in advance, Jereme
    http://www.TheJesusTV.com

  161. pamps November 4, 2007 6:30 pm

    If you put "jijfoejfoeri" or "auto ufhiur" you will find php error in search because youtube returns no match.

    Is there anyway to prevent this?

    think that, unless this is fix, it is no use to use this script..

  162. Jereme November 4, 2007 11:16 pm

    @pamps
    Yes, I agree! This is definitely an issue that limits the use of the script.

    Hoping for a fix, Jereme
    http://www.TheJesusTV.com

  163. Jereme November 5, 2007 6:32 am

    Ok, I have got it all working the way that I want it to.

    I moved the script to a server that is using php4 and now if I search for a tag that is not in the YouTube database I just get no results without the error.

    You can check it out here.
    http://www.ubuntuce.com/uketube/index.php

    Once my domain forwarding is setup you can see it here.
    http://www.ukulelevideos.com

    I would love to hear what you guys think of my implementation of the script.

    Thanks, Jereme
    http://www.TheJesusTV.com

  164. Dshe November 5, 2007 6:35 am

    @bleucube

    How about adding Downloadable URL under the flash video??

    It will be very nice, like this script does...

  165. Jac November 7, 2007 3:29 pm

    Could you please tell me where is the PHP 4 version of this class?

    Thanks

    S

    http://www.dev-exchange.com

  166. Jereme November 7, 2007 5:14 pm

    A php4 version can be found here.
    http://www.ooglester.com

    Jereme
    http://www.TheJesusTV.com

  167. Jereme November 11, 2007 10:50 am

    @Dshe

    I have just figured out how to add a Download Video link on my site that uses this script.

    You can check it out here.
    http://www.ukulelevideos.com

    If there is enough interest, I will put together something to show how I accomplished this.

    Thanks, Jereme
    http://www.TheJesusTV.com

  168. CrashDaddy November 11, 2007 7:11 pm

    Thanks bleutube!

    I used your version on the Joplin CrashPad and it worked perfectly! Only took a few minutes to install and customize and does everything you said. Is there a way maybe to get it so that if you hover your mouse over the thumbnails it will give a description?

    I haven't made a link to it yet, because I just got done, but here's a direct link:

    http://www.crashjoplin.com/joplintubepad/index.php

    Thanks again, bleubuddy!

  169. CrashDaddy November 11, 2007 7:26 pm

    NM, I figured it out. To get it to display the thumbnail video's title when you hover your mouse over the thumbnail, find the line in index.php that starts out:

    echo "'><img src='{$v['thumbnail_url']}'

    and add:

    title = '{$v['title']}' right behind it.

    Great API!

    TubeDaddy

  170. Jereme November 11, 2007 10:58 pm

    @CrashDaddy

    Thanks for the title code!!!

    This just keeps getting better!!!

    Jereme
    http://www.UkuleleVideos.com

  171. Siyon November 12, 2007 9:10 am

    hi Jereme
    where to change the code to get no video if any search item is not there in Youtube? Please help me. Thanks in advance.
    Siyon

  172. Jereme November 12, 2007 2:59 pm

    I have added a Full Page View option and a few other tweaks to http://www.UkuleleVideos.com.

    Love to hear your thoughts.

    Thanks, Jereme

    PS @Siyon

    I used a div background image to get the no video effect. See below:

    THUMBNAIL CODE

  173. Jereme November 12, 2007 3:01 pm

    @Siyon

    Sorry for the duplicate post, but the code snippet keeps getting blocked. You can send me an email at jeremehancock at whatwouldjesusdownload dot com and I would be happy to share the code with you.

    Thanks, Jereme

  174. Siyon November 13, 2007 11:51 am

    Hi Jereme thankyou for your reply. Please have a look at the mail i sent to you. Hope you'll give reply.
    Thanks, siyon

  175. Jereme November 13, 2007 1:57 pm

    @Siyon
    No problem, I just sent the code to your email.

    Let me know if you have any questions.

    Thanks, Jereme

  176. dan November 14, 2007 9:05 am

    SORRY INGONRE THAT ABOVE.... I meant this:

    LOCATE:
    $this->return = file_get_contents(youtube::return_call());

    ADD AFTER:

    $str = $this->return;
    if (preg_match("/youtube.com/i",)) {
    // echo "A match was found.";
    } else {
    echo "A match was not found."; //redirect or whatever, show error....
    }

  177. CrashDaddy November 16, 2007 12:48 am

    Hi Jereme, You're doing some good things with this code. I like the cat site! If you're not too busy spending all that Google ca$h you've GOT to be raking in with those sites, I sure wouldn't mind getting ahold of your download code.

    My email address is crashdaddy62@yahoo.com and thanks for the excellent mods!

  178. CrashDaddy November 16, 2007 12:49 am

    Oops, sorry, the cat site is Bluecube's, the Ukulele site is Jereme's...they both rock.

    DorkDaddy

  179. Jereme November 16, 2007 2:05 am

    @CrashDaddy,
    Thanks for your kind words. The http://www.UkuleleVideos.com site is a combination of ooglester's script and some other free youtube download scripts that are available online.

    You can send me an email at jeremehancock at whatwouldjesusdownload dot com and I will send you some of the resources that I used.

    Thanks, Jereme

  180. bleucube November 19, 2007 7:24 pm

    Also, folks please keep in my that this script does not use the new Gdata api. This api WILL expire in August. I'm working on a new one with Gdata that uses java (no php). Hope to release it shortly. Will post it up on ooglester.com

  181. RemiAkok November 21, 2007 1:57 pm

    fghjnffssefxc
    casino

  182. Jereme November 23, 2007 7:27 am

    @bleucube
    Can't wait to see the new script!!!

    Thanks, Jereme

  183. manchumahara November 24, 2007 10:06 pm

    Thanks for this post

  184. Muzica Noua November 25, 2007 8:10 am

    i will test it, thank you

  185. Jereme November 26, 2007 3:43 pm

    I have just put together another site using this ooglester's version of this script. I have not tested it in IE so any feedback is appreciated.

    Linux Videos:
    http://www.ubuntuce.com/ubuntube/index.php

    Thanks, Jereme
    http://www.UkuleleVideos.com

  186. Jereme November 27, 2007 6:40 am

    I have just registered a new domain for my Linux videos site.

    http://www.LinuxClips.com

    Thanks, Jereme
    http://www.UkuleleVideos.com

  187. rowan November 27, 2007 11:11 pm

    When a video is selected from the thumbnails the number of the video is displayed in the top left corner.
    Does anyone know how to change this so it does not display the number? Thanks

  188. sgrunt November 28, 2007 2:10 pm

    yes, you should remove an "echo" command that shows that number. Now i don't remember where it is, but it is easy to find.

  189. sgrunt November 28, 2007 2:11 pm

    i want to ask you all if you know how to change the video sorting order. I want to show the most recent uploaded videos and not the most relevants.

  190. rowan November 29, 2007 1:27 am

    Thanks sgrunt I found it. It worked a treat. Thanks again.

  191. Thijs November 30, 2007 4:56 pm

    Hey guys,

    I get an white screen if i search something without results..

    Any ideas?

  192. Jereme December 5, 2007 5:17 am

    Big updates for my two YouTube indexing sites!!

    I have now using a completely new system. It has a nice Admin panel for adding videos and has a lot of potential for future features.

    You can check it out here.
    http://www.phpytsite.org

    Here are my sites using it.
    http://www.UkuleleVideos.com
    http://www.LinuxClips.com

    Thanks, Jereme

  193. metoome December 11, 2007 12:26 pm

    Hi
    need the script for the "youtube.class.php" which has the code for "No videos matched your criterias " and the paging problem..

  194. Jereme December 12, 2007 6:51 am

    @metoome
    I just sent you and email explaining how I did it.
    Thanks, Jereme
    http://www.MythTube.com

  195. john December 12, 2007 11:25 am

    Jereme
    Please could you email me the same guide.
    a few of us have been trying but no luck

  196. Jereme December 12, 2007 10:33 pm

    @john
    It is really not that complicated. I simply gave the div a background image that says "video not found". The image is always displayed, but is only visible when there are no videos listed.

    To get the PHP error I had to use ooglester.com's version of the script on a PHP server.

    Hope that will help.

    Thanks, Jereme
    http://www.UkuleleVideos.com

  197. metoome December 13, 2007 1:03 pm

    Thanks Jereme, i will look into it..
    but how about the paging problem..when am on the 5th page.. and if click any of the vedio , then the vedio comes play's on the right side.. and the contents on the left returns back to first page..
    how to solve this.. ?

    Thanks..

  198. Lexa December 20, 2007 12:49 pm

    ooglester.com is dosn't work! :( Can any one send me this script? de-at-amik.ru

    Thanks!

  199. Jereme December 21, 2007 1:08 am

    @Lexa
    I have purchased ooglester.com and am in the progress of re-vamping it. So keep checking back.
    Thanks, Jereme
    http://www.UkuleleVideos.com

  200. Jereme December 22, 2007 6:10 am

    The new http://www.ooglester.com is now available. The new site focuses on a new script that uses the new YouTube API.

    Check it out and let me know what you think.

    Thanks, Jereme
    http://www.ooglester.com

  201. re: December 26, 2007 5:50 pm

    Jereme can I sell this script if I create a new template for it? Your rad me doesn't mention anything about what rights users have to this. Also, is this bug free?

  202. Jereme December 26, 2007 11:07 pm

    @re
    Yes feel free to use the script however you like. I would appreciate it if you would leave the "Powered By: ooglester.com" but that is up to you.

    Thanks, Jereme

  203. MattE December 27, 2007 10:44 am
  204. mikedd December 28, 2007 3:00 pm

    Jereme,

    Thanks for the script. I would like to change a few things but need some guidance. First, I would like to pull the most recent videos for each keyword. It looks like the script is pulling based on relevance. Second, i would like each page to have a keyword which does NOT include the front page keyword.

    I am learning PHP, but the script is way past my level. If you could give me some pointers, it would be apprecieated.

    Mike

  205. mikedd December 29, 2007 5:52 am

    I figured out how to change the order. I am stuck on the second part. Also the additional pages always always add funny to the front. I can't make them use my keyword.

    I found some of the template files (header & detail) are pulling images from your server.

  206. Jereme December 29, 2007 11:32 am

    @Mike
    I am not sure how to set it up to pull the most recent videos first. That is a good idea and I will try to look into it.

    As for having "pages" with different keywords that is fairly easy. In the ReadMe file you should see instructions for editing certain files to include the main page keyword. You can easily just remove these.

    Take a look at it and let me know if that makes sense.

    Jereme
    UkuleleVideos.com

  207. Jereme December 29, 2007 11:40 am

    @Mike
    How did you change the order?

    Thanks for letting me know about the images being pulled from my server. I have updated the demo.zip package.

    Take a look at the files listed in the ReadMe file that you are instructed to edit and you should see where you can remove the main page or default keyword from the other links.

    Just let me know if you need more help and I can email you the changes.

    Thanks, Jereme
    http://www.ooglester.com

  208. mikedd December 29, 2007 4:18 pm

    Jereme,

    Changing the order - Line 9 of /lib/services.php contians the GDATA API call. One of the parameters appended to the URL is 'orderby' which allows you cange the order. The full description of the parameters is here: http://code.google.com/apis/youtube/reference.html#VideoFeeds

    There is some thing wrong with my menu. I made all the changes in the readme, but it is still using 'funny'

    Can we bring the discussion over to the DP forums? I hate having long threads in blogs. especially in a third-parties dead blog. this thing could go down like the titanic.

  209. ashish December 29, 2007 8:50 pm

    i don't understand some site have only 2 file and display all video but some script more file and this is not work perfect.

  210. Jereme December 30, 2007 2:12 am

    @mikedd
    Thanks for finding that. I knew it was somewhere but I could not recall where. I have changed the demo and demo.zip package to come that way by default.

    Yes, I agree it would be easier to discuss this somewhere else. If you would like you can email me at jeremehancock (at) whatwouldjesusdownload (dot) com or you can start a DP forum thread and let me know the link.

    @ashish
    I honestly have no idea what you are asking or saying.
    Sorry, Jereme
    http://www.MythTube.com

  211. Aberystwyth January 1, 2008 3:34 pm

    Hi Jereme,

    Have recently installed your ooglester.com script but have a couple of problems, the right hand links and the video tags take me to a blank page?

    Do you have any ideas of what might be causing the problem? Video page found here: http://www.aberystwyth-online.co.uk/video/

    Thanks for the Script!

  212. Jereme January 2, 2008 12:58 am

    @Aberystwyth
    Did you upload the .htaccess file located in the ooglester_demo_v1.2 folder? I believe this may be why you are having the problem.

    Let me know if that fixes it.

    I am glad to hear that you like the script. I like the way you have integrated it into your site.

    Thanks, Jereme
    http://www.ooglester.com

  213. Aberystwyth January 2, 2008 1:11 am

    Hi Jereme,

    Yes the .htaccess file is upload, and have followed your instructions in the read me file, so I'm not sure what I am doing wrong?

    This is what is in the .htaccess file:

    Options -MultiViews
    RewriteEngine On

    #detail page
    RewriteRule ^video/(.*)/(.*).html detail.php?vid=$1

    #other page, process in list.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule ^.* list.php

    Any help much appreciated.
    http:www.aberystwyth-online.co.uk

  214. Jereme January 2, 2008 3:06 am

    @Aberystwyth
    Hmm, I am not sure what is going on then.

    I have simply extracted the demo package and made the one change to the init.php file and it is working perfectly. There is someone else saying they are having the same issue so something is wrong.

    You can see the demo test that I did by simply extracting the package here.
    http://www.whatwouldjesusdownload.com/ooglester/ooglester_demo_v1.2/

    Jereme

  215. Aberystwyth January 2, 2008 9:12 am

    Hi Jereme,

    Have just downloaded and installed the script within a different folder with the same results as the first, right hand links, video tags and search taking me to a blank page?

    There's probably a very simple solution but I do not know what... arrrr

    Best Regards
    http://www.aberystwyth-online.co.uk

  216. nt January 5, 2008 5:37 pm

    hi there,
    how could you use modwrite with the youtube results?
    instead of: ?video_id=164FFF
    USE: my-videos-164FFF.php (164FFF is the video ID )
    ??regards and thanks a lot.

  217. ceasar January 6, 2008 2:26 pm

    Hai jereme,

    You did a good job in your new version.
    However would it be possible to make it more simpel ?
    I mean the earlier older version was easy to set up into your own (php cms) design.
    This version is completed and too much for uses into a cms.
    I would be nice to have only two files again ( a class and a example page )
    Thanks for all your work

  218. Jereme January 7, 2008 3:31 am

    @ceasar
    I appreciate your kind words. I understand your desire to have a simpler script. However, the new script is a complete rewrite of the script. I am not the original owner of the ooglester site or script. I purchased the site and script and am working to develop the site and script with the new YouTube API in mind.

    For those who have been having trouble with the blank results. I have released v1.3 of the script that should fix the issue. The script was having trouble on servers running PHP 4. I have made a few changes and have tested the script on both PHP 4 and PHP 5.

    Please let me know if you have any trouble with the newest release.

    Thanks, Jereme
    http://www.ooglester.com

  219. Aberystwyth January 7, 2008 8:46 pm

    Hi Jereme,

    FANTASTIC!!! Your upgrade to the script has done the trick, now works great, take a look at the link:
    http://www.aberystwyth-online.co.uk/video/fun/

    Very simple script to install and customise to suit your sites layout, thanks for working out the problem and correcting it :-)

    Best Regards
    Charlie
    http://www.aberystwyth-online.co.uk

  220. Alan January 7, 2008 9:39 pm

    1.3 does in fact fix my blank page errors but has it been discussed the problem with the Next page issue?

    lets say the tag has 16 results - at 5 vids per page i get Next page up to page3 - Page3.html does not add the Next page option to get to Page4...BUT Page4.html exists and i can load it.

    Thanks for a great script

  221. Jereme January 7, 2008 11:38 pm

    @Alan
    Thanks for letting me know how it is going.

    I am not able to recreate the issue that you are having with the Next page option.

    Jereme
    http://www.ooglester.com

  222. Jereme January 7, 2008 11:39 pm

    @Alan
    Ok, I just got the Next page bug. I will work on getting that fixed for the next release. Thanks for letting me know about it.

    Jereme

  223. nt January 8, 2008 12:00 am

    hi again, have anybody used mod write with this API ?
    Id appreciate any help.
    regards

  224. DC January 8, 2008 12:57 am

    You say that you will be making a java version I hope not, tell ya the truth I prefer php java crashes ones browser quite often or do you just mean with some java script or ajax helpers, added but you said somthing like no php I think thats a big mistake in my opin

    I would love to see a version thats like the old php class that we all love, but uses the new api and is coded in php I do not like java aps at all please think about a php version that continues where the old class left off, as I made some fantastic mods based on the orig class for a client and realy need a php version ...

    Would be fantastic if thers a drop in replacement so we don't have to change much if we develped a full script around the org class which im sure many of us have ...

    Anyone else agree with me on this?

    DC

  225. nt January 8, 2008 11:02 pm

    hi jereme, i have download and installed your script trying to fit it at my website, you can check the demo at: nirvana-tributo.net/videos-youtube/index.php ,but Im gonna fit it at nirvana-tributo.net/videos-nirvana.html, Ill work on it later, now I wanna get more nirvana related videos like at videos-nirvana.html,something else, when I click on a video title,it cant be played,no video player is seen,why?
    regards

  226. Jereme January 9, 2008 6:27 am

    @nt
    Looks great.

    Are you using Internet Explorer to view the script? If so I may need to fix something. It looks great and the player is visible and functions in Firefox. Let me know and I can easily fix the issue if it is what I think it might be.
    Thanks, Jereme
    ooglester.com

  227. Manele gratis January 9, 2008 6:31 pm

    you r great man.. keep up the good work!

  228. NT January 9, 2008 9:02 pm

    hi again jereme,
    well I build websites tested in IE,Firefox,Opera,etc. I test them in every browser so make sure.well i have fixed everything I told you before,it works gr8!, now im gonna change the dir.At my actual videos section I am using youtube API and I cant install mod rewrite like you did in your script.it'd be gr8 if you can fix that(at youtube api).
    regards

  229. NT January 9, 2008 9:24 pm

    hi,I actually wanna use your script at my root,But i get a blank page,why?
    pd: I have done the same as on a different dir

  230. Jereme January 10, 2008 1:26 pm

    @NT
    I am not sure I understand what you are asking. :(

    Jereme
    http://www.TheFreeTube.net

  231. nt January 10, 2008 3:19 pm

    @jereme
    I wanna use this script but in my root,not within another directory like (videos/),But I dont want to use the index source into another page named videos.php or videos.html ,understand? I tried it,but I get a blank page.
    best regards

  232. nt January 10, 2008 11:55 pm

    @jereme,
    hi its me again,:lol:
    I have done what I was asking.check this out, this is my template (its where Im supposed to add the videos,but everytime I try,I get nothing,just blank page):
    nirvana-tributo.net/bbbbb.html
    and this is what I get when I add your script at my root(public_html),but out of my template,cause when I wanna use my template, I get a blank page like I said before:
    results:http://www.nirvana-tributo.net/aaaaa.html
    but in this case i cant get the search form and the keywords neither.
    any suggestion?

    best regards

  233. Jereme January 11, 2008 1:49 am

    If it were me I would install the script to its own directory and strip it down so that you can use an iframe on your main page. I have used this technique a lot and it can really work well.

    Jereme
    http://www.TheFreeTube.net

  234. nt January 11, 2008 9:36 pm

    @everybody
    hey guys, its donde, I have finally fit ooglester's youtube script to my own template,please check:
    http://www.nirvana-tributo.net/videos-nirvana/ and tell me suggestions, id appreciate it. now im trying to add new features,wish me luck.
    best regards

    pd:im gonna link ooglester back when its done finally.

  235. Jereme January 12, 2008 3:19 pm

    @nt
    Looks great! How did you finally get it going?

    I would definitely appreciate the link back.

    Great Job!!

    Jereme
    http://www.TheFreeTube.net

  236. NT January 12, 2008 3:39 pm

    @Jereme
    hi,
    well I edited all of the default files with my own template,added description and keywords meta tags,and installed MIMETYPES to change the index.php to index.html as default.I was tryng to delete the video ID from the SEO URL,but I couldnt make it cause the video couldnt be displayed.But after all,I worked it out.
    best regards,

  237. NT January 15, 2008 9:58 pm

    hi
    any way to make a comments system based on the video ID?

    best regards

  238. ali January 28, 2008 9:21 am

    hi
    any way to sort videos by uploaded date same as :
    http://fr.youtube.com/results?search_query=celtics&search_sort=video_date_uploaded

    i have trying the api but my results are older than last videos..

    best regards

  239. Game January 30, 2008 5:47 pm

    Where's the php 4 version? I can't find it in this nice blog. Could you please show me the link?

  240. Muzica Noua January 31, 2008 4:59 pm

    thx for this site...great job

  241. oetube February 1, 2008 12:23 pm

    hi,,great script,,get me busy many hours.:-) anybody want to share the page navigatie fix??,,also i want the video lenght in minutes in the script,,who can help.

  242. Jereme February 3, 2008 11:51 am

    We have just added a new YouTube Downloader Script at http://www.ooglester.com!

    Thanks, Jereme
    http://www.TheFreeTube.com

  243. wijchen February 4, 2008 7:30 am

    Jeremy

    Can you make the script van waxjelly using the gdat,i look into your files but not understand,,plz me.

    thanxx

  244. [...] After doing a bit of snooping round for a simple Youtube API Class for a site I am currently working on, I found this. [...]

  245. ST February 8, 2008 3:55 pm

    Hi Jereme,

    I'm trying to install your scrip but I'm getting this error:

    Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of xml_parse_into_struct(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. in .../lib/xml2array.php on line 5

    Warning: Invalid argument supplied for foreach() in .../index.php on line 57

    Help Please. I'm stuck and my knowledge of PHP is like… well…Zero.
    The site is hosted with DreamHost.

    Best Regards

  246. Marisa February 13, 2008 3:41 am

    Hi there, is your script still available anywhere? the links to the zip files no longer work.

    Thanks so much!

  247. NT February 13, 2008 4:56 pm

    @ anybody
    Have you installed a comments systema based on the video ID. That'd be cool. :lol:

    best regards !

  248. Adnan Siddiqi February 22, 2008 7:22 am

    Hi

    Your tutorial is very nice I am looknig more info in easy details. Following re queries:

    1)how to log into system to show videos(if login is required)

    2)display videos of particular user.
    3)showing rating and comments
    4)Video browser(preview)

    I will be greatful if you send it to me. I have also bookmarked your page. Urgent help needed

  249. lucki March 2, 2008 12:38 am

    When i have empy string the page give error:

    Fatal error: Cannot use string offset as an array in D:\xampp\htdocs\welcome\youtube.class.php on line 197

    Any ideeas?

    Any bug fix released?

  250. bogdanel March 6, 2008 8:14 pm

    many thanks my dear pall

  251. C00L March 8, 2008 7:54 am

    hi plz help me i m use this script but this not work and send error

    Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/www/globalnet.awardspace.com/te/youtube.class.php on line 36

    plz tell me plzzzzzzzzzzzzzzzz

  252. artakus March 10, 2008 3:51 am

    any file update for php 4 version?

  253. R March 15, 2008 3:00 pm

    I now know what your youtube dev id is. You should really keep it secret

  254. Ankit March 18, 2008 10:20 am

    how can i integrate you tube in my site

  255. Jacques March 20, 2008 12:36 am

    Hello, is there any problem right now in Youtube getting videos? I'm getting Undefined index: video_list in youtube.class.php on line 193

  256. Stealth March 20, 2008 2:21 am

    Yes, I am getting the same error, their server went down?

  257. Jacques March 20, 2008 10:54 pm

    Any luck how to get a solution?

    Best,

  258. lucki March 21, 2008 12:26 am

    Any bug fix on youtube.class for PHP5 because if i search with_underlines or special characters give me error.

    If somebody have it please share with me.

    Thanx and greetings from Romania

  259. lucki March 21, 2008 12:27 am

    And i need please for pagination too. Thx

  260. Stealth March 21, 2008 6:28 am

    I notice that
    $pagecontent = file_get_contents($_POST["youtubeurl"]);

    file_get_contents function always return empty when sending the request to a youtube URL, on the other hand if
    $pagecontent = file_get_contents("http://www.google.com");

    then it works fine, anyone have any idea why youtube URL now doesn't work?

  261. andy March 30, 2008 2:38 pm

    Just wondering if you are still working on the php4 version.

    thanks in advance.

  262. [...] Recurso: Una clase en PHP con ejemplos para utilizar la API [...]

  263. wil April 10, 2008 4:59 pm

    script is stop working,,youtube problem???????

  264. sc April 11, 2008 5:49 am

    Just tried the script, and it errors out complaining about the video_list variable.

  265. popwilddotcom April 12, 2008 6:25 am

    The scripts was working a week ago. Today it finally quit working. I think the reason behind this error is the new implementation of You Tube API.

  266. Steve April 15, 2008 1:44 am

    Hi just downloaded the script and played, everyone is having problems but what got me is with mutemath the script works, figured out its with any spaces you put in your search query, until there is a fix, and im sure its a minor php thing, just put %20 where your spaces would be and atleast the thumbnails come back, and thats the only bit i want :D, ill post again after i try and get the player bit working. This free script is great by the way, I have been using javascript, thanks a load to the developers, I look forward to any advancements :D

  267. Popwilddotcom April 16, 2008 4:29 pm

    I replaced the entire scripts with one javascript per You tube's recommendation. It is working really well, but still requires some refinement specially positioning the player if used within the existing site, but if used on a single page, it works perfectly fine. Here is the sample site http://popwild.com/youtube.php. I used a simple page refresh javascript to clear the search results. My only concern is the positioning of the player.

  268. Zaiaku April 19, 2008 11:23 pm

    Thi script is long past its due time now. There's been so many advancement with simliar scripts, that this script has gone to dust for the time.

  269. me May 21, 2008 2:39 pm

    Please, can you tell me how can I do to display all related comments of a video?

    Best regards.

  270. Md. Aminul Islam June 3, 2008 4:42 pm

    Excellent but i need a bit more.. moreover, i need to upload video to youtube.com from my site. i feel, its possible but i don't know how. Please someone let me know how can i do it and able to upload video from my site. In addition, a tutorial video will be best help for me.
    Thanks.
    Aminul (aminulsumon@gmail.com)
    http://www.shopno-dinga.com

  271. meshach June 6, 2008 3:11 pm

    Md. Aminul,

    You need the Google Developer API kit. It allows you to Authenticate remotely, which gives you all the functionality of the youtube site.

    Here's the link:

    http://code.google.com/apis/youtube/developers_guide_protocol.html

    Good luck.

  272. celebs August 3, 2008 12:55 pm

    I cant see demo? Please renew

  273. Diogo August 7, 2008 1:03 pm

    http://waxjelly.wordpress.com/2007/03/08/youtube-api-class-redeaux/ Is not working ?? Can i use this class or use the real youtube api ? in code.gooogle.com :? Tnks..

  274. Rakibul Islam August 12, 2008 10:56 pm

    finally nothing is working today. No video is coming, i just getting warning:
    -----------------------------------
    Warning: Invalid argument supplied for foreach() in /home/.../public_html/youtube.class.php on line 175

    Warning: Invalid argument supplied for foreach() in /home/.../public_html/movies/video.php on line 154
    ----------------------------------

    What should i do now, how to fix that? the new developer key is not working with this youtube class.

Leave a comment

Please be polite and on topic. Your e-mail will never be published.