Probléme de code youtube

Fermé
bertrand - 2 mars 2012 à 02:07
 bertrand - 2 mars 2012 à 02:24
Bonjour, le code juste en dessous ne fonctionne plus de l'aide svp merci.



<?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]['link']=str_replace("&amp;feature=youtube_gdata","",$ytvids[$ytid]['link']);
			$ytvids[$ytid]['link']=str_replace("&feature=youtube_gdata","",$ytvids[$ytid]['link']);
			$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_once("fetch.php");
	$ytdata = fetchrss("http://gdata.youtube.com/feeds/videos?vq=$ytsearch&start-index=1&max-results=50");
	if(!(xml_parse($ytxml_parser, $ytdata)))
		die("Error on line " . xml_get_current_line_number($ytxml_parser));
	
	xml_parser_free($ytxml_parser);
	
	return $ytvids;
}
?> 
A voir également:

2 réponses

Templier Nocturne Messages postés 7716 Date d'inscription jeudi 22 janvier 2009 Statut Membre Dernière intervention 21 mai 2016 1 101
2 mars 2012 à 02:10
Quel est le problème ?
Detaille le script et resume le
0
j'ai script php qui aux visiteurs de lire des vidéos google video ou daylimotion et youtube mais depuis quelques jour le code youtube ne fonctionne plus je sait que youtube change souvent leurs système mais je suis perdu.

lorsque je fait une recherche de vidéo il me donne les liens mais la lecture est impossible.
0