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
pass form variables straight to email, no database required?
hello all,
im working on this form...
http://www.adobedayevents.com/project_request/pr
Number Format
Hi All,
I have number '000000000050085' I want to format it to 500.85 Can any one give me
Database 'Validation'
Hi everyone,
I'm trying to validate the password entered by the user with the password in the dat
insert mysql embeded videos as blobs?
Using TinyMCE my client will be able to embed images and flash videos into large columns of text whi
Get content from table into a list, without repeating.
Alright this is kinda an odd thing, so I need some help.
I have a table "quote" wit
While Problem
i am having a problem with a while statement here is the code
Code: [Select]<?php
sess
Table sorting
Hi,
I'm trying to modify the following in order to make the output table sorted alphabeticall
Captcha problem users just refresh and it will let them auto submit again
Users will just re submit and not have to enter the new captcha.. ? Lol but if i refresh the page, t
order by date not ID number help php
I am trying to orginize the following code to order by date not id number.
any help would be grea
Converting RGB values to HEX
Code: <?PHP
$file_handle = fopen("colors/rgb.csv", "r");
wh