Esempio n. 1
0
 public function getVideoDownLoadUrl()
 {
     $content = file_get_contents($this->url);
     preg_match('#movieDescription=\'([^\']+)\'#', $content, $result);
     if (!($title = $result[1])) {
         preg_match("#<title>(.+)</title>#", $content, $result);
         $title = $result[1];
     }
     $title = iconv('gb2312//ignore', 'utf-8', $title);
     $this->title = $title;
     preg_match('#<source src="([^"]+)#', $content, $src) or preg_match('#<source type="[^"]+" src="([^"]+)"#', $content, $src);
     $videoSrc = $src[1] ? $src[1] : '';
     if ($videoSrc) {
         preg_match('#(.+)-mobile.mp4#', $videoSrc, $sdUrls);
         $sdUrl = $sdUrls[1] . '.flv';
         $hdUrl = preg_replace('#SD#', 'HD', $sdUrl);
         $curl = new curl();
         $sdHeader = $curl->curlGet302($sdUrl);
         $hdHeader = $curl->curlGet302($hdUrl);
         $sdSize = $curl->getSize($sdHeader);
         $hdSize = $curl->getSize($hdHeader);
         if ($sdSize > $hdSize) {
             $url = $sdUrl;
         } else {
             $url = $hdUrl;
         }
         $this->ext = 'flv';
     } else {
         preg_match('#["\'](.+)-list.m3u8["\']#', $content, $urls) || preg_match('#["\'](.+).m3u8["\']#', $content, $urls);
         $url = $urls[1] . '.mp4';
         $this->ext = 'mp4';
     }
     return $url;
 }
Esempio n. 2
0
    echo '<p align="center">下载列表:</p>
		<ul>';
    /* now that we have the array, print the options */
    for ($i = 0; $i < count($avail_formats); $i++) {
        echo '<li>';
        echo '<span class="itag">' . $avail_formats[$i]['itag'] . '</span> ';
        if ($config['VideoLinkMode'] == 'direct' || $config['VideoLinkMode'] == 'both') {
            echo '<a href="' . $avail_formats[$i]['url'] . '&title=' . $cleanedtitle . '" class="mime">' . $avail_formats[$i]['type'] . '</a> ';
        } else {
            echo '<span class="mime">' . $avail_formats[$i]['type'] . '</span> ';
        }
        echo '<small>(' . $avail_formats[$i]['quality'];
        if ($config['VideoLinkMode'] == 'proxy' || $config['VideoLinkMode'] == 'both') {
            echo ' / ' . '<a href="download.php?mime=' . $avail_formats[$i]['type'] . '&title=' . urlencode($my_title) . '&token=' . base64_encode($avail_formats[$i]['url']) . '" class="dl">download</a>';
        }
        echo ')</small> ' . '<small><span class="size">' . $common->formatBytes($curl->getSize($avail_formats[$i]['url'])) . '</span></small>' . '</li>';
    }
    //echo '</ul><small>Note that you initiate download either by clicking video format link or click "download" to use this server as proxy.</small>';
    echo '<ul><small>由于网络受限,下载的视频会存在本地硬盘,下载后还需要再手动上传到vms系统中</small></ul>';
    if ($config['feature']['browserExtensions'] == true && is_chrome()) {
        //   echo '<a href="ytdl.user.js" class="userscript btn btn-mini" title="Install chrome extension to view a \'Download\' link to this application on Youtube video pages."> Install Chrome Extension </a>';
    }
    ?>

</body>
</html>

<?php 
} else {
    /* In this else, the request didn't come from a form but from something else
     * like an RSS feed.