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
19
Other forums
pop3 and fsockopen
So I am able to connect to the pop3 server, log in, and check how many messages there are. I am hav
Connecion issue
Hi,
For some reason, I keep getting this error when trying to connect:
Warning: mysql_
Need help-Error istream header declaration
Hi Everyone ,
I am having issue with istream declaration. I am new to C programming.
can a
Had a simple form script that suddenly stopped working
It was made about a year ago and had been working fine. Last time it was known to work for sure was
Cannot Display Array from Select Statement + Login question
Hi,
I'm new to PHP but so far so goog. I was assigend a project and I'm very close to completion.
Is it possible to stop reservation creation in PM Order?
Hi All,
Is it possible to stop reservation creation in PM Order?
Thanks in adv
Saving PHP output as a file
I wondered if anyone knows how to save the rendered output of a PHP script as a file?
I have
RFQ Configuration - can you make PLANT field an optional field in ME42
Is there a way to make the plant field on an RFQ optional in change mode (ME42)?
Generate PDF
Hi guys,
I would like to know if there is a way to generate pdf when clicking on a link. In f
SWF image using php?
Hello once again.
My latest en devour requires me to produce an image of a static .swf that i