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:
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
-
include('youtube.class.php');
-
$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
-
$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.
-
$res = $yt->videos('mutemath');
...build the video list array
-
$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
-
<div class="paginate">
-
<a href="?page=<?=YOUTUBE_PREV_PAGE ?>"><<prev</a>
-
:: page <?=YOUTUBE_PAGE ?> of <?=YOUTUBE_TOTAL_PAGES ?> ::
-
</a><a href="?page=<?=YOUTUBE_NEXT_PAGE ?>">next>></a>
-
</div>
...BUILD A TABLE OF RESULTS, LOOPING THROUGH 3 COLUMNS ON EACH ROW
...loop through each video in the list and display it for design purposes
-
$i = 0;
-
foreach ($video_list as $k => $v) {
...limit the title's length so it doesn't break the design
-
echo "<td class='thumb'>
-
<a href='?video_id={$v['id']}'><img src='{$v['thumbnail_url']}'/></a><br />
-
<span class='title_short'>{$title}</span><br />
-
<span class='length_short'>{$v['length_seconds']}</span>
-
<span class='rating_short'>{$v['rating_avg']} / {$v['rating_count']}</span>
-
</td>";
-
$i++;
...only 3 videos per row
-
if ($i == 3) {
-
$i = 0;
-
echo '</tr><tr>';
-
}
-
}
-
?>
-
</tr>
-
</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.
-
<h2>
-
<?=$video_list[YOUTUBE_VIDEO_INDEX]['title'] ?>
-
</h2>
Next, we setup the flash object call from the standard youtube format, and pass it the value for the video id
-
<object width="425" height="350">
-
<param name="movie" value="http://www.youtube.com/v/<?=YOUTUBE_VIDEO_ID ?>"></param>
-
<param name="wmode" value="transparent"></param>
-
<embed src="http://www.youtube.com/v/<?=YOUTUBE_VIDEO_ID ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
-
</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
-
<div id="description">
-
<?=$video_list[YOUTUBE_VIDEO_INDEX]['description'] ?>
-
</div>
-
<div class="stats">Views: <span class="statVal"><?=$video_list[YOUTUBE_VIDEO_INDEX]['view_count'] ?></span><br />
-
Comments: <span class="statVal"><?=$video_list[YOUTUBE_VIDEO_INDEX]['comment_count'] ?></span><br />
-
Tags: <span class="statVal"><?=$yt->tags_for_video($video_list[YOUTUBE_VIDEO_INDEX]['tags']) ?></span><br />
-
</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]
You may Leave a comment or Subscribe to Comments RSS or Trackback this entry.
[...] 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. … [...]
[...] View the new post here Posted by Meshach Filed in API's, HTML / CSS, YouTube, PHP / MySQL, Web Sites, Tutorials [...]
[...] View the new post here Posted by Meshach Filed in API's, HTML / CSS, YouTube, PHP / MySQL, Tutorials, Web Sites, Web 2.0 [...]
I will be implementing this killa feature into our EPK, If I can get it going. Thanks for the great work!
Wrock. Let us know when it's in place!
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
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 ?
hello!
please tell me if i`m allowed to use adsense on this script. Thank You!
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.
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!
Thanks for the reply bryan.
I'll look forward to it :)
Razvan, please just include the following somewhere on your implementation of the script and you'll be fine:
another project by waxjelly
thnx.
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!
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.
Is there an easy way to make it display the videos of specified user instead of tag?
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.
Meshach thank you for your answer
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
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.
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);
Hi,
Very nice plug-in. Is PHP4 there yet?
Is this script available for php4 version?
Very good script.
When php4 version will be available?
Vaibhav... soon. We promise.
Emulatore... Thanks for the bug fix. We'll get that implemented as soon as we can.
Coming soon... "PHP4 vs PHP5: what's the diff, and why should you care?"
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
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).
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!
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!
waxjelly thinkin build a ajax version of this class?
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 ?
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
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
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.
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());
}
//
Not english bug
get error if Tag or search none english.
I would like to have this in a php4 version.
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
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?
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
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
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!
Hi, is it possible to get this to work on a Group instead on searching a tag?
And what about that php4 version? Does anyone know where to go to download it???
Bob,
Can u pls post your solution here. I try to fix the multi-keyword search with no success. Ty
So has the php4 project been given up on? Does anyone have an update?
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!
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
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?
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?
Forget it, I fixed it. The cut and paste created incorrect ' and "
$this->tag = '&tag='. str_replace(" ", "+", $_GET['tag']);
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
Anyone have this for PHP4 yet?
Johno - I found the way to correct this is to align the DIV to center. That will fix it.
Excelent!,
now, u know how can i upload videos?
...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
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?
@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!
Send me an email bleucube @ gmail.com for php4 version that includes most fixes list here and additional functions.
Sweet!!! This is exactly what I've been looking for :D Thanks for this!!
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);
}
You might want to replace that with $clean = urlencode($this->api_call);
MrKryptic are you using the php5 or original version? So far I haven't came across any problems with spaces.
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
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.
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.
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.
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.
Sounds very good Zaiaku
Can you share these updates?
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.
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.
Maybe I should wait to you all release the updated versions to make sure the no confliccs. Then include the changes I made.
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.
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.
Hey do you guys have any time frame for the next release ?
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
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
The updating the code. Give them time to post a new link with all the fixes.
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"]);
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']);
nice one gavetips
thank
And sorry to my post above....here have str_replace to LOL
If you put this code before ...not work
Place the code ABOVE “return $array;”
There's a diffrent between those too lines?
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.
Can anyone send the code of video_id=***&tag=***&page=***
The demo is not the same as the zip file
[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?
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) {
they will be releasing a new version with all the bug fixes. There will be a new story post about it.
hi, this is a nice script thnx. we are waiting for your new version.
If you post the incomplete code maybe i can increase the code to work fine.
You'll proably have to get someone to uploa the old version to do that.
No updates?
when you release the next version?
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:
Sorry....my code don´t appear here...
Not that anyone has used charcters like that on my pages but would be nice to cover all basis just incase.
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']));
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.
waiting for the "video_id=***&tag=***&page=***" code... i've tried to get it by myself, but i couldn't get it right....
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.
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!
God....Sorry...i can´t post codes here.....because here have strip_tags lol
Look my Printscreen
http://morllaines.com/imagehost/out.php?i=266_code.jpg
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
interesting thank you...
car deal enterprise rent alaska fishing lodge for sale
Dana that uses a totally different script.
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
another bug of my code, it doesn't work on index... until you click on next page..
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
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
No updates?:
is it possible to get code for page numbering problems now.
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.
OK thanks for the info of future updates.
Has anyone got the pagination fix now?
Hi Wax can you send me a working version or the latest version I would gladly appreciate it.
i cant get it work this, could anyone did it?
thanks
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.
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
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
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.
is new script coming out? if yes when will this be?
""""hi guys
pls can anybody