请注意,本文编写于 927 天前,最后修改于 653 天前,其中某些信息可能已经过时。
前段时间写了个皮皮虾无水印解析的API,可以获取封面、标题、无水印视频链接,源码呈上.
代码:
<?php
/**
*
*皮皮虾无水印解析
* By、ッ小眼睛っ
* 聚光网络博客 https://www.rncen.com/
*
* https://h5.pipix.com/s/J8KFRqW/
* https://h5.pipix.com/item/6823536835323500811?app_id=1319&app=super×tamp=1593348598&carrier_region=cn®ion=cn&language=zh&utm_source=weixin
* https://h5.pipix.com/bds/webapi/item/detail/?item_id=6823536835323500811&source=share
*
* name data.item.content
* img data.item.cover.url_list[0].url
* video data.item.video.video_fallback.url_list[0].url
*
*/
header('Access-Control-Allow-Origin:*');
header('Content-type:application/json; charset=utf-8');
error_reporting(0);
if(!array_key_exists('url',$_REQUEST))exit(error("缺少参数"));
$url =@$_REQUEST;
preg_match("/https:\/\/h5.pipix.com\/s\/\S+/",$url['url'],$res);
if (!$res)exit(error("请检查你输入的链接"));
function error($str){
return json_encode([
"code"=>-1,
"msg"=>$str
],JSON_UNESCAPED_UNICODE);
}
function curl($url, $getinfo=false)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_NOBODY, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 3600);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1'));
if($getinfo){
curl_exec($ch);
$data = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);
}else{
$data = curl_exec($ch);
}
curl_close($ch);
return $data;
}
preg_match("/item\/(.*?)\?/",get_headers($res[0], TRUE)['location'],$ids);//获取皮皮虾item_id
if(!$ids[1])exit(error("数据异常,请稍后再试"));
$datas = json_decode(curl('https://h5.pipix.com/bds/webapi/item/detail/?item_id='.$ids[1].'&source=share'));
exit(json_encode([
"code"=>1,
"msg"=>"获取成功",
"data"=>[
'title' => $datas->data->item->content,
'img' => $datas->data->item->cover->url_list[0]->url,
'videourl' => $datas->data->item->video->video_fallback->url_list[0]->url
]
],JSON_UNESCAPED_UNICODE));