皮皮虾无水印解析API源码

聚光网络博客

发表文章数:25

首页 » 网站源码 » 皮皮虾无水印解析API源码

前段时间写了个皮皮虾无水印解析的API,可以获取封面、标题、无水印视频链接,源码呈上.

<?php
/**
 *
 *皮皮虾无水印解析
 * By、ッ小眼睛っ
 * 聚光网络博客 https://www.rncen.com/
 *
 * https://h5.pipix.com/s/J8KFRqW/
 * https://h5.pipix.com/item/6823536835323500811?app_id=1319&app=super&timestamp=1593348598&carrier_region=cn&region=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 [email protected]$_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));

 

调用方法:
http://localhost/ppx.php?url=分享的链接

 

未经允许不得转载:作者:聚光网络博客, 转载或复制请以 超链接形式 并注明出处 聚光网络博客
原文地址:《皮皮虾无水印解析API源码》 发布于2020-07-20

分享到:
赞(1) 生成海报

评论 抢沙发

2 + 2 =


长按图片转发给朋友

Vieu4.5主题
专业打造轻量级个人企业风格博客主题!专注于前端开发,全站响应式布局自适应模板。
切换注册

登录

忘记密码 ?

切换登录

注册