becoolufull Posted December 30, 2009 Share Posted December 30, 2009 I use a script on my site which grabs youtube videos to my site and embeds them. Everything works fine but the thumbnail is not showing up. Like this is my site http://video.gamerslove.com/index.php?search=gta&source=all All the thumbnails are not showing up. the URL of thumbnails is http://img.youtube.com/vi/A2SsL329Y6k&feature=youtube_gdata/2.jpg but I need the URL of thumbnails to be http://img.youtube.com/vi/A2SsL329Y6k/2.jpg So I want to remove this extra &feature=youtube_gdata for my script to work fully. I saw an old thread on PHPFREAK mentioning the solution but I couldn't get it. http://www.phpfreaks.com/forums/index.php/topic,273565.30.html Where should I change the code? this is my code <?php function yt($ytsearch) { global $ytcurrenttag; global $ytvids; global $ytid; $ytvids = array(); $ytid=0; function ytinsidethetag($ytparser, $ytdata){ global $ytcurrenttag; global $ytvids; global $ytid; if(!strcmp(strtolower($ytcurrenttag),"title")) { $ytvids[$ytid]['type'] = "yt"; $ytvids[$ytid]['title']=$ytdata; $ytvids[$ytid]['title'][0] = ucwords($ytvids[$ytid]['title'][0]); } } function ytopentag($ytparser, $ytdata, $ytattr=''){ global $ytcurrenttag; $ytcurrenttag = $ytdata; global $ytvids; global $ytid; if(!strcmp(strtolower($ytcurrenttag),"media:player")) { $ytvids[$ytid]['link']=str_replace("watch?v=","v/",$ytattr['URL']); $ytvids[$ytid]['thumb']=str_replace("http://www.youtube.com/v/","http://img.youtube.com/vi/",$ytvids[$ytid]['link']); $ytvids[$ytid]['thumb'].="/2.jpg"; } } function ytclosetag($ytparser, $ytdata){ global $ytid; if(!strcmp(strtolower($ytdata),"entry")) $ytid++; } $ytxml_parser = xml_parser_create(); xml_set_element_handler($ytxml_parser, "ytopentag", "ytclosetag"); xml_set_character_data_handler($ytxml_parser, "ytinsidethetag"); include("fetch.php"); $ytdata = fetchrssyt("http://gdata.youtube.com/feeds/videos?vq=$ytsearch&start-index=1&max-results=40"); if(!(xml_parse($ytxml_parser, $ytdata))) die("Error on line " . xml_get_current_line_number($ytxml_parser)); xml_parser_free($ytxml_parser); return $ytvids; } ?> Link to comment https://forums.phpfreaks.com/topic/186714-small-youtube-thumbnail-fix-error/ Share on other sites More sharing options...
becoolufull Posted December 31, 2009 Author Share Posted December 31, 2009 is there anyone who can help me? Link to comment https://forums.phpfreaks.com/topic/186714-small-youtube-thumbnail-fix-error/#findComment-986424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.