示例#1
0
文件: mq.php 项目: istrwei/youtube
function getDURLbyU_m($url, $q_list)
{
    $str = get_net_data($url);
    if (hasBadKey($str)) {
        return array("no", "Garbage", "Garbage", "Garbage", "0", "0");
    }
    $tit = stristr($str, "<title>");
    $p2 = strpos($tit, "</title>");
    $tit = substr($tit, 8, $p2 - 8);
    $tit = stristr($tit, "-");
    $tit = substr($tit, 2);
    $temp1 = 'description" content="';
    $des = stristr($str, $temp1);
    $des = substr($des, strlen($temp1));
    $p2 = strpos($des, '">');
    $des = substr($des, 0, $p2);
    $des2 = "";
    /*
    	$des2 = stristr($str,'class="watch-video-desc description"');
    	$p2 = strpos($des2,'</div>');
    	$des2 = substr($des2,0,$p2);
    	$des2 = stristr($des2,'<span');*/
    $theU = "";
    @($theU = getDURL(fmt_url_map(getArgDataFromStr($str)), $q_list));
    return array($theU, $tit, $des, $des2, "0", "0");
}
示例#2
0
文件: index.php 项目: istrwei/youtube
function ShowVideoGallery($dataid, $time = "", $local = "-")
{
    $url = ytapi . 'standardfeeds/';
    if ($local == "-") {
        $url .= ytpos;
    } else {
        if (strlen($local) > 0) {
            $url .= $local . '/';
        }
    }
    $url .= $dataid;
    if (strlen($time) > 0) {
        $url .= "?time=" . $time;
    }
    $xml = xml_load2($url);
    if ($xml != NULL) {
        vg_head();
        foreach ($xml->entry as $entry) {
            $media = $entry->children('http://search.yahoo.com/mrss/');
            ob_start();
            print_r($media);
            $checking = ob_get_contents();
            ob_end_clean();
            if (hasBadKey($checking)) {
                //out_bad();
            } else {
                $yt = $media->children('http://gdata.youtube.com/schemas/2007');
                $gd = $entry->children('http://schemas.google.com/g/2005');
                $title = $media->group->title;
                $author = $entry->author->name;
                $description = $media->group->description;
                ob_start();
                echo $media->group->category;
                $category = ob_get_contents();
                ob_end_clean();
                $attrs = $media->group->player->attributes();
                $id = $attrs['url'];
                $id = substr(stristr($id, "v="), 2, 11);
                $attrs = $media->group->thumbnail[0]->attributes();
                $thumbnail = $attrs['url'];
                $thumbnail = 'https://images2-focus-opensocial.googleusercontent.com/gadgets/proxy?url=' . urlencode($thumbnail) . '&container=focus&gadget=a&no_expand=1&resize_h=0&rewriteMime=image%2F*';
                //$thumbnail = 'lib/ytp.php?'.(str_replace("ytimg","yx_x",str_replace("/","|",$thumbnail)));
                $attrs = $yt->duration->attributes();
                $length = $attrs['seconds'];
                $attrs = $yt->statistics->attributes();
                $viewCount = "0";
                @($viewCount = $attrs['viewCount']);
                if ($gd->rating) {
                    $attrs = $gd->rating->attributes();
                    $rating = $attrs['average'];
                    $rating = substr($rating, 0, 3);
                } else {
                    $rating = 0;
                }
                vg_out($id, $title, $author, $description, $length / 60, $rating, $viewCount, $category, $thumbnail);
            }
        }
        vg_end();
    } else {
        echo '<b><a href="http://code.google.com/p/youtubeindex/">NGSY</a>_FAILED:LOAD_VIDEO_LIST</b><br>Please contact laobubu@gmail.com';
    }
}
示例#3
0
}
if (isset($_GET['page'])) {
    $page = strval($_GET['page']);
}
include 'lib/mq.php';
include_once "lib/apirequest.php";
initGFW('lib/mglib.txt');
$xml = xml_load2(ytapi . 'playlists/' . $ID . '?max-results=50&start-index=' . (($page - 1) * 15 + 1) . '&rand=' . rand(0, 1995));
/*$tit = $xml->title;
$media = $xml->children('http://search.yahoo.com/mrss/');
$description_full = str_replace("\n","<br>",$media->group->description);
$description = substr($description_full,0,140);
$author = $xml->author->uri;		$author = substr(strstr($author,'users/'),6);

@date_default_timezone_set(PRC);
$updateTime  = date("Y-m-d H:i:s",strtotime($xml->updated));
*/
$videos = array();
foreach ($xml->entry as $entry) {
    ob_start();
    print_r($entry);
    $checking = ob_get_contents();
    ob_end_clean();
    if (!hasBadKey($checking)) {
        $media = $entry->children('http://search.yahoo.com/mrss/');
        $attrs = $entry->link->attributes();
        $vid = substr(stristr($attrs["href"], "v="), 2, 11);
        array_push($videos, array('id' => $vid, 'title' => $media->group->title, 'author' => $entry->author->name));
    }
}
include THEME_PATH . "/list_ajax.php";
示例#4
0
        curl_close($ch);
    }
    return $file_contents;
}
$empty = '<transcript></transcript>';
if (!isset($_GET['id'])) {
    die($empty);
}
if (!isset($_GET['lang'])) {
    die($empty);
}
include_once "gfw.php";
initGFW('mglib.txt');
$url = 'http://video.google.com/timedtext?hl=zh&type=track&lang=' . $_GET['lang'] . '&name=' . urlencode($_GET['name']) . '&v=' . $_GET['id'];
if (isset($_GET["tlang"])) {
    $url .= "&tlang=" . $_GET["tlang"];
}
echo '<!-- ' . $url . ' -->';
$out = get_net_data($url);
if (strlen($out) < 10) {
    die($empty);
}
if (strpos($out, '<title>404 Not Found</title>') > 5) {
    die($empty);
}
if (hasBadKey($out)) {
    die($empty);
}
$out = str_replace("&amp;", "&", $out);
print $out;
die(ob_get_contents());
示例#5
0
$page = 1;
if (isset($_GET['id'])) {
    $ID = $_GET['id'];
}
if (isset($_GET['page'])) {
    $page = strval($_GET['page']);
}
include_once 'lib/mq.php';
include_once "lib/apirequest.php";
initGFW('lib/mglib.txt');
$xml_comment = xml_load2(ytapi . 'videos/' . $ID . '/comments?max-results=15&start-index=' . (($page - 1) * 15 + 1) . '&rand=' . rand(0, 8964));
if ($xml_comment == NULL) {
    $error = true;
} else {
    $opensearch = $xml_comment->children('http://a9.com/-/spec/opensearchrss/1.0/');
    $comments = array();
    $comments_has_prev = $page > 1;
    $comments_has_next = count($xml_comment->entry) >= 15;
    $comments_pages = ceil($opensearch->totalResults / 15);
    if ($xml_comment != NULL) {
        foreach ($xml_comment->entry as $entry) {
            $tauthor = $entry->author->name;
            $tcontent = $entry->content;
            $tdate = date("Y-m-d H:i:s", strtotime($entry->published));
            if (!hasBadKey($tcontent)) {
                array_push($comments, array("author" => $tauthor, "content" => $tcontent, "published" => $tdate));
            }
        }
    }
}
include THEME_PATH . "/comment_ajax.php";