| Autor | Zpráva | ||
|---|---|---|---|
| B8xer Profil * |
#1 · Zasláno: 23. 9. 2012, 14:07:29
Cau, vytiahol som s youtube api cas prekonvertoval ale on neni presny ukazujem nekedy aj 30 sekund viac menej ... na jednom webe som to videl autommaticke a bolo to presne tu je moj kod
<?php
$sxml = simplexml_load_file('http://gdata.youtube.com/feeds/api/videos/EPGMc1EQKpU');
$media = $sxml->children('http://search.yahoo.com/mrss/');
$yt = $media->children('http://gdata.youtube.com/schemas/2007');
$attr1 = $media->group->thumbnail[0]->attributes();
$thumbnail = $attr1['url'];
$attr2 = $yt->duration->attributes();
$length = $attr2['seconds'];
$dur = round($length/60,2);
echo $dur
?> |
||
| B8xer Profil * |
#2 · Zasláno: 23. 9. 2012, 15:09:14
Vyreseno
<?php
$id = '8VusUgClhQE';
$sxml = simplexml_load_file('http://gdata.youtube.com/feeds/api/videos/'.$id);
$media = $sxml->children('http://search.yahoo.com/mrss/');
$yt = $media->children('http://gdata.youtube.com/schemas/2007');
$attr1 = $media->group->thumbnail[0]->attributes();
$thumbnail = $attr1['url']; // Url
$attr2 = $yt->duration->attributes();
$length = $attr2['seconds']; // Ziskanie sekund
$video_duration = floor($length/60) . ":" . $length % 60;//ziskanie minut
echo $video_duration;//Vypisem
?> |
||
|
Časová prodleva: 14 let
|
|||
0