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
please help me in this update statment
hi every one
if I have table and this data in it
id name
10
RadioButtonList item spacing
I have a RadioButtonList and I can't put any spacing between the items. They are arranged verticall
my two tables
table1 : col1 = topicid , col2 = topic
table2 : col1 = sentid, col2 = sentence
Cod
using explode() to fill in checkboxes
Hi
I have a field stored in a table that contains regions in the UK separated by commas. Ther
problem in program for counting no of chars using pointers
Hi all, I was trying to make a program which counts number of chars in a string using concpt of poin
Save data in input fields when they press "BACK BUTTON"
Hi, this is html form: And let's say they get a error "Please enter ur title must be more then
VAT
how should I deal with VAT?
if I have a product that costs £5.00 and VAT @ 17.5% (£0.87
Table trouble
i have been reading the forum for a few weeks and decided to join. i like the format and the advice
Login Control?!
I have a Web Site that uses the login control also I have set the destinationurl to the page I want
Quick variable question
hey guys/gals,
im trying to write a php script and it works fine as i have it, but i need to set