全网首发哔哩哔哩API接口代码-七彩云资源网

作者 : 七彩云 本文共4685个字,预计阅读时间需要12分钟 发布时间: 2020-03-31 共1.14K人阅读

代码(把?php前面的&lt;换成<):

<?php
header('Content-Type:text/html;charset=utf-8');
$aid=$_GET['aid'];
$bid=$_GET['bid'];

if($aid==null && $bid==null){
	echo '请输入av或bv号!';
	}else{
if($bid!=null){
$b1= file_get_contents("https://api.bilibili.com/x/web-interface/view?bvid=$bid");

$l1 = str_ireplace('"aid":',"AV号:AV",$b1,$count);

$l2 = str_ireplace('"pic":"',"封面:",$b1,$count);

$l3 = str_ireplace('"title":"',"标题:",$b1,$count);

$l4 = str_ireplace('"desc":"',"介绍:",$b1,$count);

$l5 = str_ireplace('"view":',"播放:",$b1,$count);

$l6 = str_ireplace('"like":',"点赞:",$b1,$count);

$l7 = str_ireplace('"coin":',"投币:",$b1,$count);

$l8 = str_ireplace('"share":',"转发:",$b1,$count);

$l9 = str_ireplace('"danmaku":',"评论:",$b1,$count);

$l10 = str_ireplace('"favorite":',"收藏:",$b1,$count);

$l11 = str_ireplace('"name":"',"作者昵称:",$b1,$count);

$l12 = str_ireplace('"mid":',"作者UID:",$b1,$count);

$l13 = str_ireplace('"face":"',"作者头像:",$b1,$count);

echo "BV号:BV$bid";
echo "</br>";

$str="$l1";
$t1 = mb_strpos($str,'AV号:AV');
$t2 = mb_strpos($str,',"videos":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l2";
$t1 = mb_strpos($str,'封面:');
$t2 = mb_strpos($str,'","title":"');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l3";
$t1 = mb_strpos($str,'标题:');
$t2 = mb_strpos($str,'","pubdate":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l4";
$t1 = mb_strpos($str,'介绍:');
$t2 = mb_strpos($str,'","state":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l5";
$t1 = mb_strpos($str,'播放:');
$t2 = mb_strpos($str,',"danmaku":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l6";
$t1 = mb_strpos($str,'点赞:');
$t2 = mb_strpos($str,',"dislike":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l7";
$t1 = mb_strpos($str,'投币:');
$t2 = mb_strpos($str,',"share":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l10";
$t1 = mb_strpos($str,'收藏:');
$t2 = mb_strpos($str,',"coin":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l8";
$t1 = mb_strpos($str,'转发:');
$t2 = mb_strpos($str,',"now_rank":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l9";
$t1 = mb_strpos($str,'评论:');
$t2 = mb_strpos($str,',"reply":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l11";
$t1 = mb_strpos($str,'作者昵称:');
$t2 = mb_strpos($str,'","face":"');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l12";
$t1 = mb_strpos($str,'作者UID:');
$t2 = mb_strpos($str,',"name":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l13";
$t1 = mb_strpos($str,'作者头像:');
$t2 = mb_strpos($str,'"},"stat":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

}else{
$b2= file_get_contents("https://api.bilibili.com/x/web-interface/view?aid=$aid");

$l1 = str_ireplace('"bvid":"',"BV号:",$b2,$count);

$l2 = str_ireplace('"pic":"',"封面:",$b2,$count);

$l3 = str_ireplace('"title":"',"标题:",$b2,$count);

$l4 = str_ireplace('"desc":"',"介绍:",$b2,$count);

$l5 = str_ireplace('"view":',"播放:",$b2,$count);

$l6 = str_ireplace('"like":',"点赞:",$b2,$count);

$l7 = str_ireplace('"coin":',"投币:",$b2,$count);

$l8 = str_ireplace('"share":',"转发:",$b2,$count);

$l9 = str_ireplace('"danmaku":',"评论:",$b2,$count);

$l10 = str_ireplace('"favorite":',"收藏:",$b2,$count);

$l11 = str_ireplace('"name":"',"作者昵称:",$b2,$count);

$l12 = str_ireplace('"mid":',"作者UID:",$b2,$count);

$l13 = str_ireplace('"face":"',"作者头像:",$b2,$count);

$str="$l1";
$t1 = mb_strpos($str,'BV号:');
$t2 = mb_strpos($str,'","aid":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";
echo "AV号:AV$aid";
echo "</br>";

$str="$l2";
$t1 = mb_strpos($str,'封面:');
$t2 = mb_strpos($str,'","title":"');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l3";
$t1 = mb_strpos($str,'标题:');
$t2 = mb_strpos($str,'","pubdate":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l4";
$t1 = mb_strpos($str,'介绍:');
$t2 = mb_strpos($str,'","state":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l5";
$t1 = mb_strpos($str,'播放:');
$t2 = mb_strpos($str,',"danmaku":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l6";
$t1 = mb_strpos($str,'点赞:');
$t2 = mb_strpos($str,',"dislike":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l7";
$t1 = mb_strpos($str,'投币:');
$t2 = mb_strpos($str,',"share":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l10";
$t1 = mb_strpos($str,'收藏:');
$t2 = mb_strpos($str,',"coin":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l8";
$t1 = mb_strpos($str,'转发:');
$t2 = mb_strpos($str,',"now_rank":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l9";
$t1 = mb_strpos($str,'评论:');
$t2 = mb_strpos($str,',"reply":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l11";
$t1 = mb_strpos($str,'作者昵称:');
$t2 = mb_strpos($str,'","face":"');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l12";
$t1 = mb_strpos($str,'作者UID:');
$t2 = mb_strpos($str,',"name":');
echo $s = mb_substr($str,$t1,$t2-$t1);
echo "</br>";

$str="$l13";
$t1 = mb_strpos($str,'作者头像:');
$t2 = ";
}}tr($str,$t1,$t2-$t1);
echo "</br>";
}}tr($str,$t1,$t2-$t1);
echo "</br>";
}}

 

如有侵权请提供相关证明到sjhyzwds@gmail.com
请加入官方QQ群1056114416
七彩云资源网 » 全网首发哔哩哔哩API接口代码-七彩云资源网

发表评论