Needing Youtube thumb nail fix.


Posted on 16th Feb 2014 07:03 pm by admin

I have a script on a site that pulls in you-tube videos,
The problem is, that the thumb nails for the site, no longer show up.

I have tried to add codes to remove the line causing the problem but this fails me.
The code is this if anyone has a way to fix it.

<?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;
}

?>

The code in the browser for the thumb comes up.
http://img.youtube.com/vi/lOgQyIMX_XU&feature=youtube_gdata/2.jpg

and i think for it to work i need.

http://img.youtube.com/vi/lOgQyIMX_XU/2.jpg
lOgQyIMX_XU = whatever video needs to be displayed.

Someone said to try this.
$ytid = str_replace('feature=youtube_gdata', '',$ytid);
$ytid = str_replace('&', '',$ytid);
$ytid = str_replace('amp;', '',$ytid);

but it did nothing for the problem
Thanks

No comments posted yet

Your Answer:

Login to answer
179 Like 19 Dislike
Previous forums Next forums
Other forums

need help with this contact form
I made this form and I need it to read the data and write the data to a table and its not working ca

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

PHP error. Need help urgently
Hi,

I am programming a php site and have a problem that i just cant find out how to fix. When

How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.

H

How do I get the row number from from an sql table query
Hi all

I have a table that I query and it returns a number of rows.
mysql_num_rows($query)

login page does not execute a else statement
I've created a login page using sessions.
When an incorrect user name or password is entered then

text box alphanumeric caracters only
hi all!

I have search on google on how to enter in a test box only caracters A-Z,a-z,0-9 usi

Locking mysql tables with php
Hi

BACKGROUND:
I have multiple instances of the same php script running in a WAMP environ

Multiple upload and Resize
I would like some help on my script I have the for my index.php

////

<html&

Custom array sort? asc then desc
Any ideas how I could sort this array? I've been trying for a while. Maybe with usort, but I have no

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash