diff --git a/bangumi.php b/bangumi.php index e76208dc..4c312c26 100755 --- a/bangumi.php +++ b/bangumi.php @@ -1,32 +1,66 @@ need('includes/head.php'); $this->need('includes/header.php'); -$this->need('libs/Bangumi.php'); + + +function curl($url, $cookie) +{ + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, $url); + //地址 + //curl_setopt ($curl, CURLOPT_COOKIEJAR, $cookiefile);//文件式 + //curl_setopt ($curl, CURLOPT_COOKIEFILE, $cookiefile); + curl_setopt($curl, CURLOPT_COOKIE, $cookie); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + $str = curl_exec($curl); + curl_close($curl); + return $str; +} + +function getSubstr($str, $leftStr, $rightStr) +{ + $left = strpos($str, $leftStr); + //echo '左边:'.$left; + $right = strpos($str, $rightStr, $left); + //echo '
右边:'.$right; + if ($left < 0 or $right < $left) return ''; + return substr($str, $left + strlen($leftStr), $right - $left - strlen($leftStr)); +} + if ($this->fields->uid == !'' && $this->fields->sessdata == !'') { - bilibili::setUserInfo($this->fields->uid, $this->fields->sessdata); if (empty($_GET['page']) || $_GET['page'] == 0) $page = 1; else $page = $_GET['page']; - $bgmdataraw = bilibili::getFollowingListRaw($page,16); - $bgmlist = bilibili::getFormatList($bgmdataraw['data']['list']); + $curl = curl_init(); + curl_setopt($curl, CURLOPT_URL, 'https://api.bilibili.com/x/space/bangumi/follow/list?type=1&follow_status=0&vmid=' . $this->fields->uid . '&ps=16&pn=' . $page); + curl_setopt($curl, CURLOPT_COOKIE, 'SESSDATA=' . $this->fields->sessdata . ';'); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + $str = curl_exec($curl); + curl_close($curl); + $bgmdataraw = json_decode($str, true); + $error = false; + if (!$bgmdataraw) $error = true; } else { $bgmdataraw = array(); $bgmlist = array(); @@ -34,7 +68,7 @@ function is_https() { // Uncomment for debugging /* -if ($_GET['dbg'] == 'fuck') { +if ($_GET['dbg'] == 'format') { echo "
";
     print_r($bgmlist);
     echo "
"; @@ -48,70 +82,106 @@ function is_https() { ?>
-
- - //content - - //if nothing - -**/ -?> -
+
+
- - - - -

- -
+ //番组链接 $bgm['link']; + //番组名字 $bgm['name']; + //番组封面 $bgm['img']; + //番组介绍 $bgm['des']; + //观看进度 $bgm['watched'] . "/" . $bgm['all'] + //更新至 $bgm['new']['title']; + //观看状态 if ($bgm['basket'] == 0) echo '想看'; + // if ($bgm['basket'] == 1) echo '在看'; + // if ($bgm['basket'] == 2) echo '看完'; + /** + * 开始循环 + * + * //content + * + * //if nothing + * + **/ + ?> +
-
-
-
- - - - -
-
+
+
+
+ + + + +
+
need('includes/comments.php'); ?>
diff --git a/libs/Bangumi.php b/libs/Bangumi.php deleted file mode 100644 index e8d63058..00000000 --- a/libs/Bangumi.php +++ /dev/null @@ -1,211 +0,0 @@ - '第' . $total . '话 ' . (isset($bangumi['new_ep']['long_title']) ? $bangumi['new_ep']['long_title'] : $bangumi['new_ep']['title']), //紫罗兰的永恒花园为例子,最后一集没有long_title - 'ep' => $total, - 'finish' => $bangumi['is_finish'] - ); - - $ret[] = $temp; - //循环尾 看清楚 - } - return $ret; - } - - private static function getSubstr($str, $leftStr, $rightStr) - { - $left = strpos($str, $leftStr); - //echo '左边:'.$left; - $right = strpos($str, $rightStr, $left); - //echo '
右边:'.$right; - if ($left < 0 or $right < $left) return ''; - return substr($str, $left + strlen($leftStr), $right - $left - strlen($leftStr)); - } -} \ No newline at end of file