Пример #1
0
<link rel="stylesheet" href="main.css" />
</head>
<body>
<div style="text-align:center;font-size:1.2em;line-height:2.5em;">
点击链接下载:<br />
<?php 
//获取分p
if (isset($_GET['p'])) {
    $p = $_GET['p'];
} else {
    $p = 1;
}
//获取aid
if (isset($_GET['aid'])) {
    $aid = $_GET['aid'];
    list($cid, $img) = hy_getinfo($aid, $p);
} elseif (isset($_GET['cid'])) {
    $cid = $_GET['cid'];
} else {
    echo '<span class="warn">{"code":-1,"message":"请输入av号.AID_ERROR"}</span></div></body></html>';
    exit;
}
//获取mp4
$cdata = file_get_contents('http://interface.bilibili.com/playurl?appkey=452d3958f048c02a&otype=json&cid=' . $cid);
if (!!strpos($cdata, 'error_code')) {
    echo '<span class="warn">' . $cdata . '</span></div></body></html>';
    exit;
} else {
    $cdata = json_decode($cdata, true);
    //Debug bili_cdata_api
    //echo '<h1>Debuging</h1>';var_dump($cdata);exit;
Пример #2
0
<link rel="icon" type="image/ico" href="http://www.bilibili.com/favicon.ico" />
<link rel="stylesheet" href="main.css" />
</head>
<body onload="fixsize()">
<div style="text-align:center;">
<?php 
//获取分p
if (!empty($_GET['p'])) {
    $p = $_GET['p'];
} else {
    $p = '1';
}
//获取aid
if (!empty($_GET['aid'])) {
    $aid = $_GET['aid'];
    $cid = hy_getinfo($aid, $p);
} elseif (!empty($_GET['cid'])) {
    $cid = $_GET['cid'];
} else {
    echo '<span class="warn">{"code":-1,"message":"请输入av号.AID_ERROR"}</span></div></body></html>';
    exit;
}
function hy_getinfo($aid, $p)
{
    $cookie = dirname(__FILE__) . "/cookie.tmp";
    $url = 'http://api.bilibili.com/view?appkey=12737ff7776f1ade&id=' . $aid . '&page=' . $p;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; rv:37.0) Gecko/20100101 Firefox/37.0');
    curl_setopt($ch, CURLOPT_HEADER, 0);
Пример #3
0
$agent = hy_chwap();
if ($agent) {
    header('Location:wap.php?' . $_SERVER["QUERY_STRING"]);
    exit;
}
//获取分p
if (!empty($_GET['p'])) {
    $p = $_GET['p'];
} else {
    $p = '1';
}
//获取aid
if (!empty($_GET['aid'])) {
    $aid = $_GET['aid'];
    //获取cid及视频信息
    list($cid, $img, $title, $up) = hy_getinfo($aid, $p);
} elseif (!empty($_GET['cid'])) {
    //进行cid请求
    $cid = $_GET['cid'];
} else {
    echo '<html><head><title>错误 - 冰河动漫 - 直播</title><link rel="stylesheet" href="main.css" /></head><body><form method="get" action="">av号:<input class="text" type="text" name="aid" size="6" maxlength="9" />Part:<input class="text" type="text" name="p" size="2" maxlength="3" value="1" /><input class="submit" type="submit" value="Go!" /> <a class="jump" onClick="jump()">试试手气</a></form><hr /><div style="text-align:center;"><span class="warn">{"code":-1,"message":"请输入av号.AID_ERROR"}</span></div><script src="main.js"></script></body></html>';
    exit;
}
function hy_chwap()
{
    if (stristr($_SERVER['HTTP_VIA'], "wap")) {
        return true;
    } elseif (strpos(strtoupper($_SERVER['HTTP_ACCEPT']), "VND.WAP.WML") > 0) {
        return true;
    } elseif (preg_match('/(blackberry|configuration\\/cldc|hp |hp-|htc |htc_|htc-|iemobile|kindle|midp|mmp|motorola|mobile|nokia|opera mini|opera |Googlebot-Mobile|YahooSeeker\\/M1A1-R2D2|android|iphone|ipod|mobi|palm|palmos|pocket|portalmmm|ppc;|smartphone|sonyericsson|sqh|spv|symbian|treo|up.browser|up.link|vodafone|windows ce|xda |xda_)/i', $_SERVER['HTTP_USER_AGENT'])) {
        return true;