示例#1
0
 function youtube_get_status($url, $use_tor)
 {
     $id = youtube_get_videoid($url);
     if ($id != '') {
         $a = youtube_get_download_urls($id, $use_tor, 0);
         if (isset($a)) {
             // DEBUG
             //          echo $a['status']."\n";
             return $a['status'];
         }
     }
     return NULL;
 }
 function widget_video_youtube_download($media_url, $tor_enabled)
 {
     $p = '';
     //  $yt_array = youtube_download ($media_url, $tor_enabled, 0);
     $yt_array = youtube_get_download_urls($media_url, $tor_enabled, 0);
     // DEBUG
     //  echo '<pre><tt>';
     //  echo $media_url."\n";
     //  print_r ($a);
     $yt = $yt_array[0];
     if ($yt['status'] == 'fail') {
         $p .= $yt['errorcode'] . ': ' . $yt['reason'];
         switch ($yt['errorcode']) {
             case 150:
                 // copyright
                 $p .= '<br>' . ' Probably Naziwalled against access from your country<br>' . 'Try a proxy or service that is located in the country of the possible license owner';
                 break;
             case 100:
                 // removed by user
             // removed by user
             default:
                 break;
         }
         return $p;
     }
     //  [fmt_list] => 35/854x480/9/0/115,34/640x360/9/0/115,18/640x360/9/0/115,5/320x240/7/0/0
     $a = explode(',', $yt['fmt_list']);
     $p .= 'Download: <a href="' . $yt['video_url'] . '">Best</a>';
     for ($q = 0; isset($yt[$q]); $q++) {
         $b = explode('/', $a[$q]);
         $fmt = substr($yt[$q], 0, strpos($yt[$q], '|'));
         $t = substr($yt[$q], strpos($yt[$q], '|') + 1);
         $p .= ' <a href="' . $t . '" title="&fmt=' . $fmt . '">' . $b[1] . '</a>';
     }
     // direct link
     //  $p .= ' <a href="'.$yt['ad_eurl'].'">Direct</a>';
     $p .= '<br>';
     $p .= '' . 'Name: <input type="text"' . ' value="' . $yt['title'] . '" readonly="readonly"' . '>';
     $p .= '<br>';
     // details
     $p .= widget_collapse('Details', '<!-- div style="width:200px;height:100px;overflow:auto;" --><pre><tt>' . sprint_r($yt) . '</tt></pre><!-- /div -->', 1);
     return $p;
 }
示例#3
0
                        type="video/quicktime"
                        medium="video"
                        isDefault="true" 
                        expression="full" 
                        bitrate="128" 
                        framerate="25"
                        samplingrate="44.1"
                        channels="2"
                        duration="185" 
                        height="200"
                        width="300" 
                        lang="en" />
         */
         // direct download
         $id = youtube_get_videoid($a['item'][$i]['link']);
         $b = youtube_get_download_urls($id, 0, $debug);
         for ($j = 0; isset($b[$j]); $j++) {
             if (in_array($output, array('pls', 'm3u'))) {
                 $a['item'][$i]['media:content_' . $j . '_url'] = urlencode($b[$j]);
             } else {
                 $a['item'][$i]['media:content_' . $j . '_url'] = $b[$j];
             }
             $a['item'][$i]['media:content_' . $j . '_medium'] = 'video';
             //            $a['item'][$i]['media:content_'.$j.'_duration'] = $a['item'][$i]['media:duration'];
             //            $a['item'][$i]['media:content_'.$j.'_width'] = 400;
             //            $a['item'][$i]['media:content_'.$j.'_height'] = 300;
         }
         // HACK: enrich with information from wikipedia?
         //        $a['item'][$i]['rsscache:wikipedia'] =
     }
 }