好东西要分享

皮皮虾短视频无水印解析源码

<?php  /**   * 使用方法: ?url=https://h5.pipix.com/item/6634495721250756878?app_id=1319&app=super&utm_source=weixin×tamp=1548050295&user_id=100524312840   */    header("Content-Type: application/json");  $url = isset($_GET['url']) ? $_GET['url'] : die("参数不能为空");  preg_match('/b[1-9]d*/', $url, $item_id);  if(!isset($item_id[0])){        $result['code'] = 400;        $result['msg'] = "获取失败";      exit(json_encode($result));  }  $item_id = trim($item_id[0]);  $UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36";  $json = MloocCurlGet("https://lf.snssdk.com/bds/item/detail?item_id=$item_id", true, $UserAgent);  $json = json_decode($json, true);    if(!isset($json['data']['data']['share']['title']) || !isset($json['data']['data']['video']['video_low']['url_list'][0]['url']) || !isset($json['data']['data']['video']['video_low']['cover_image']['url_list'][0]['url'])){        $result['code'] = 400;        $result['msg'] = "获取失败";      exit(json_encode($result));  }    $result['code'] = 200;  $result['msg'] = "获取成功";  $result['title'] = $json['data']['data']['share']['title'];  $result['cover'] = $json['data']['data']['video']['video_low']['cover_image']['url_list'][0]['url'];  $result['playAddr'] = $json['data']['data']['video']['video_low']['url_list'][0]['url'];    exit(json_encode($result));    function MloocCurlGet($url, $idFllow=false, $UserAgent = '')  {      $curl = curl_init();      curl_setopt($curl, CURLOPT_URL, $url);      #关闭重定向        if($idFllow){          curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);      }        if($UserAgent){          curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);      }                //curl_setopt($curl, CURLOPT_HEADER, 1);        if($cookie!=""){          curl_setopt($curl, CURLOPT_COOKIE, $cookie);      }          #关闭SSL      curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);      curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);      #返回数据不直接显示      curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);        $response = curl_exec($curl);      curl_close($curl);      return $response;  }

相关推荐

  • 暂无文章

评论 抢沙发

评论前必须登录!