Filmy Filmy

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

in 代码相关 文章转载请注明来源!

前言

前几天写了个抖音去水印的,然后最近在玩皮皮虾,想下载一些视频,发现都有水印,然后就写了个接口了,开源。

演示地址:http://pic.mlooc.cn/analysis?url=https://h5.pipix.com/item/6634495721250756878?app_id=1319&app=super&utm_source=weixin×tamp=1548050295&user_id=100524312840

代码

<?php
/**
 * Created by PhpStorm.
 * User: Filmy
 * Ver: 1.0.1
 * Date: 2019/1/27
 * Time: 18:35
 */

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://is.snssdk.com/bds/item/detail/?app_name=super&aid=1319&item_id=$item_id", false);
$json = json_decode($json, true);
if($json['status_code'] != 0){
      $result['code'] = 400;
      $result['msg'] = $json['prompt'];
    exit(json_encode($result));
}
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);
    }
  
    #关闭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;
}
MHan WeChat Pay

微信打赏

Mhan Alipay

支付宝打赏

文章二维码

扫描二维码,在手机上阅读!

本文基于《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
文章链接:https://mlooc.cn/archives/pipixia.html (转载时请注明本文出处及文章链接)

代码相关
发表新评论
已有 5 条评论
  1. w0ai1uo
    w0ai1uoChrome
    回复

    老哥,终于上google找到了你博客,这个皮皮虾解析失效了啊。

    1. Filmy
      Filmy本文作者 10Chrome
      回复

      @w0ai1uo 好啦,修复了

      1. w0ai1uo
        w0ai1uoChrome
        回复

        @Filmy 大哥,给个联系方式嘛

        1. Filmy
          Filmy本文作者 10Chrome
          回复

          @w0ai1uo 关于页面有哦

      2. w0ai1uo
        w0ai1uoChrome
        回复

        @Filmy dalao收下我的膝盖

雷姆
拉姆