• 正文概述
  • 该源码为短视频解析算法,非调用接口,是根据平台算法进行视频解析,可用于短视频平台解析,以及API调用,短视频去水印解析网站程序,截图为写的解析页面跟解析无关,解析只是数据字段,内含解析页面模板,欢迎下载学习交流。

    短视频解析源码
    短视频解析源码

    解析支持:目前支持下列平台视频去水印下载

    皮皮虾 、 抖音短视频、火山短视频 、 皮皮搞笑、 全民K歌 、微视短视频 、微博、最右 、 vuevlog 、 小咖秀、轻视频、快手短视频 、 全民小视频、 陌陌、 Before避风等。

    算法源码:

    <?php
    /**
     * @package Video_spider
     * @author  iami233
     * @version 1.0.2
     * @link    https://www.35ym.cn/252.html
    **/
    
    namespace Video_spider;
    class Video
    {    
        public function pipixia($url){
            $loc = get_headers($url, true)['location'];
            preg_match('/item/(.*)?/',$loc,$id);
            $arr = json_decode($this->curl('https://is.snssdk.com/bds/cell/detail/?cell_type=1&aid=1319&app_name=super&cell_id='.$id[1]), true);
            $arr = array(
                'code' => 200,
                'data' => array(
                    'author' => $arr['data']['data']['item'] ['author']['name'],
                    'avatar' => $arr['data']['data']['item'] ['author']['avatar']['download_list'][0]['url'],
                    'time' => $arr['data']['data']['display_time'],
                    'title' => $arr['data']['data']['item']['content'],
                    'cover' => $arr['data']['data']['item']['cover']['url_list'][0]['url'],
                    'url' => $arr['data']['data']['item']['origin_video_download']['url_list'][0]['url']
                )
            );
            return $arr;
        }
    
        public function douyin($url){
            $loc = get_headers($url, true)['location'];
            preg_match('/video/(.*)//',$loc,$id);
            $arr = json_decode($this->curl('https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids='.$id[1]), true);
            preg_match('/href="(.*?)">Found/', $this->curl(str_replace('playwm', 'play', $arr['item_list'][0]["video"]["play_addr"]["url_list"][0])), $matches);
            $video_url = str_replace('&', '&', $matches[1]);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $arr['item_list'][0]['author']['nickname'],
                    'uid' => $arr['item_list'][0]['author']['unique_id'],
                    'avatar' => $arr['item_list'][0]['author']['avatar_larger']['url_list'][0],
                    'like' => $arr['item_list'][0]['statistics']['digg_count'],
                    'time' => $arr['item_list'][0]["create_time"],
                    'title' => $arr['item_list'][0]['share_info']['share_title'],
                    'cover' => $arr['item_list'][0]['video']['origin_cover']['url_list'][0],
                    'url' => $video_url,
                    'music' => array(
                        'author' => $arr['item_list'][0]['music']['author'],
                        'avatar' => $arr['item_list'][0]['music']['cover_large']['url_list'][0],
                        'url' => $arr['item_list'][0]['music']['play_url']['url_list'][0],
                    )
                )
            );
            return $arr;
        }
    
        public function huoshan($url){
            $loc = get_headers($url, true)['location'];
            preg_match('/item_id=(.*)&tag/',$loc,$id);
            $arr = json_decode($this->curl('https://share.huoshan.com/api/item/info?item_id='.$id[1]), true);
            $url = $arr['data']['item_info']['url'];
            preg_match('/video_id=(.*)&line/',$url,$id);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'cover' => $arr["data"]["item_info"]["cover"],
                    'url' => 'https://api-hl.huoshan.com/hotsoon/item/video/_playback/?video_id='.$id[1]
                )
            );
            return $arr;
        }
    
        public function weishi($url){
            preg_match('/feed/(.*)b/',$url,$id);
            if (strpos($url,'h5.weishi') != false){
                $arr = json_decode($this->curl('https://h5.weishi.qq.com/webapp/json/weishi/WSH5GetPlayPage?feedid='.$id[1]),true);
            } else {
                $arr = json_decode($this->curl('https://h5.weishi.qq.com/webapp/json/weishi/WSH5GetPlayPage?feedid='.$url),true);   
            }
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $arr['data']['feeds'][0]['poster']['nick'],
                    'avatar' => $arr['data']['feeds'][0]['poster']['avatar'],
                    'time' =>$arr['data']['feeds'][0]['poster']['createtime'],
                    'title' => $arr['data']['feeds'][0]['feed_desc_withat'],
                    'cover' => $arr['data']['feeds'][0]['images'][0]['url'],
                    'url' => $arr['data']['feeds'][0]['video_url'],
                )
            );
            return $arr;
        }
    
        public function weibo($url){
            if (strpos($url,'show?fid=') != false){
                preg_match('/fid=(.*)/',$url,$id);
                $arr = json_decode($this->curl('https://video.h5.weibo.cn/s/video/object?object_id='.$id[1]),true);
            } else {
                preg_match('/d+:d+/',$url,$id);
                $arr = json_decode($this->curl('https://video.h5.weibo.cn/s/video/object?object_id='.$id[0]),true);
            }
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $arr['data']['object']['author']['screen_name'],
                    'avatar' => $arr['data']['object']['author']['profile_image_url'],
                    'time' => $arr['data']['object']['created_at'],
                    'title' => $arr['data']['object']['summary'],
                    'cover' => $arr['data']['object']['image']['url'],
                    'url' => $arr['data']['object']['stream']['hd_url']
                )
            );
            return $arr;
        }
    
        public function lvzhou($url){
            $text = $this->curl($url);
            preg_match('/<div class="text">(.*)</div>/',$text,$video_title);
            preg_match('/<div style="background-image:url((.*))/',$text,$video_cover);
            preg_match('/<video src="([^"]*)"/',$text,$video_url);
            preg_match('/<div class="nickname">(.*)</div>/',$text,$video_author);
            preg_match('/<a class="avatar"><img src="(.*)?/',$text,$video_author_img);
            preg_match('/<div class="like-count">(.*)次点赞</div>/',$text,$video_like);                  
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $video_author[1],
                    'avatar' => str_replace('1080.180','1080.680',$video_author_img)[1],
                    'like' => $video_like[1],
                    'title' => $video_title[1],
                    'cover' => $video_cover[1],
                    'url' => $video_url[1],
                )
            );
            return $arr;
        }
    
        public function zuiyou($url){
            $text = $this->curl($url);
            preg_match('/:</span>(.*?)</div></div><div class="ImageBoxII">/',$text,$video_title);
            preg_match('/<img alt="" src="(.*?)/id/(.*?)/sz/',$text,$video_cover);
            preg_match('/'.$video_cover[2].',"(.*)url":"(.*)","prior/',$text,$url);
            $video_url = str_replace('','/',str_replace('u002F','',$url[2]));
            preg_match('/<span class="SharePostCard__name">(.*?)</span>/',$text,$video_author);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $video_author[1],
                    'title' => $video_title[1],
                    'cover' => 'https://file.izuiyou.com/img/png/id/' . $video_cover[2].'/sz/600',
                    'url' => $video_url,
                )
            );
           return $arr;    
        }
    
        public function bbq($url){
            preg_match('/id=(.*)b/',$url,$id);
            $arr = json_decode($this->curl('https://bbq.bilibili.com/bbq/app-bbq/sv/detail?svid='.$id[1]),true);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $arr['data']['user_info']['uname'],
                    'avatar' => $arr['data']['user_info']['face'],
                    'time' => $arr['data']['pubtime'],
                    'like' => $arr['data']['like'],
                    'title' => $arr['data']['title'],
                    'cover' => $arr['data']['cover_url'],
                    'url' => $arr['data']['play']['file_info'][0]['url'],
                )
            );
           return $arr;  
        }
    
        public function kuaishou($url){
            $loc = get_headers($url, true)["Location"][0];
            $text = $this->curl($loc);
            preg_match('/{"title":"(.*?)","desc/', $text, $video_title);
            preg_match('/poster="(.*?)"/', $text, $video_cover);
            preg_match('/srcNoMark":"(.*?)"}/', $text, $video_url);
            preg_match('/<div class="auth-name">(.*?)</div>/', $text, $video_author);
            preg_match('/<div class="auth-avatar" style="background-image:url((.*?))/', $text, $video_avatar);
            preg_match('/timestamp":(.*?),"/', $text, $video_time);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $video_author[1],
                    'avatar' => $video_avatar[1],
                    'time' => $video_time[1],
                    "title"=> $video_title[1],
                    "cover"=> $video_cover[1],
                    "url"=> $video_url[1],
                )
            );
            return $arr;
        }
    
        public function quanmin($id){
            $arr = json_decode($this->curl('https://quanmin.hao222.com/wise/growth/api/sv/immerse?source=share-h5&pd=qm_share_mvideo&vid='.$id.'&_format=json'),true);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $arr["data"]["author"]['name'],
                    'avatar' => $arr["data"]["author"]["icon"],
                    "title"=> $arr["data"]["meta"]["title"],
                    "cover"=> $arr["data"]["meta"]["image"],
                    "url"=> $arr["data"]["meta"]["video_info"]["clarityUrl"][0]['url']
                )
            );
            return $arr;
        }
        public function basai($id){
            $arr = json_decode($this->curl('http://www.moviebase.cn/uread/api/m/video/'.$id.'?actionkey=300303'),true);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'time' => $arr[0]['data']['createDate'],
                    'title' => $arr[0]['data']['title'],
                    "cover"=> $arr[0]['data']['coverUrl'],
                    "url"=> $arr[0]['data']['videoUrl']
                )
            );
            return $arr;
        }
        
        public function before($url){
            preg_match('/detail/(.*)?/',$url,$id);
            $arr = json_decode($this->curl('https://hlg.xiatou.com/h5/feed/detail?id='.$id[1]),true);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $arr['data'][0]['author']['nickName'],
                    'avatar' => $arr['data'][0]['author']['avatar']['url'],
                    'like' => $arr['data'][0]['diggCount'],
                    'time' => $arr['recTimeStamp'],
                    'title' => $arr['data'][0]['title'],
                    "cover"=> $arr['data'][0]['staticCover'][0]['url'],
                    "url"=> $arr['data'][0]['mediaInfoList'][0]['videoInfo']['url']
                )
            );
            return $arr;
        }
    
        public function kaiyan($url){
            preg_match('/?vid=(.*)b/',$url,$id);
            $arr = json_decode($this->curl('https://baobab.kaiyanapp.com/api/v1/video/'.$id[1].'?f=web'),true);
            $video = 'https://baobab.kaiyanapp.com/api/v1/playUrl?vid='.$id[1].'&resourceType=video&editionType=default&source=aliyun&playUrlType=url_oss&ptl=true';
            $video_url = get_headers($video, true)["Location"];
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'title' => $arr['title'],
                    "cover"=> $arr['coverForFeed'],
                    "url"=> $video_url
                )
            );
            return $arr;
        }
    
        public function momo($url){
            preg_match('/new-share-v2/(.*).html/',$url,$id);
            $post_data = array("feedids" => $id[1],);
            $arr = json_decode($this->post_curl('https://m.immomo.com/inc/microvideo/share/profiles', $post_data),true);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $arr['data']['list'][0]['user']['name'],
                    'avatar' => $arr['data']['list'][0]['user']['img'],
                    'uid' => $arr['data']['list'][0]['user']['momoid'],
                    'sex' =>$arr['data']['list'][0]['user']['sex'],
                    'age' => $arr['data']['list'][0]['user']['age'],
                    'city' => $arr['data']['list'][0]['video']['city'],
                    'like' => $arr['data']['list'][0]['video']['like_cnt'],
                    'title' => $arr['data']['list'][0]['content'],
                    "cover"=> $arr['data']['list'][0]['video']['cover']['l'],
                    "url"=> $arr['data']['list'][0]['video']['video_url']
                )
            );
            return $arr;
        }
    
        public function vuevlog($url){
            $text = $this->curl($url);
            preg_match('/<title>(.*?)</title>/', $text, $video_title);
            preg_match('/<meta name="twitter:image" content="(.*?)">/', $text, $video_cover);
            preg_match('/<meta property="og:video:url" content="(.*?)">/', $text, $video_url);
            preg_match('/<div class="infoItem name">(.*?)</div>/', $text, $video_author);
            preg_match('/<div class="avatarContainer"><img src="(.*?)"/', $text, $video_avatar);
            preg_match('/<div class="likeTitle">(.*) friends/', $text, $video_like);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $video_author[1],
                    'avatar' => $video_avatar[1],
                    'like' => $video_like[1],
                    'title' => $video_title[1],
                    "cover" => $video_cover[1],
                    "url" => $video_url[1], 
                )
            );
            return $arr;
        }
    
        public function xiaokaxiu($url){
            preg_match('/id=(.*)b/',$url,$id);
            $sign = md5('S14OnTD#Qvdv3L=3vm&time='.time());
            $arr = json_decode($this->curl('https://appapi.xiaokaxiu.com/api/v1/web/share/video/'.$id[1].'?time='.time(), ["x-sign : $sign"]),true);
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'author' => $arr['data']['video']['user']['nickname'],
                    'avatar' => $arr['data']['video']['user']['avatar'],
                    'like' => $arr['data']['video']['likedCount'],
                    'time' => $arr['data']['video']['createdAt'],
                    'title' => $arr['data']['video']['title'],
                    'cover' => $arr['data']['video']['cover'],
                    'url' => $arr['data']['video']['url'][0]
                )
            );
            return $arr;
        }
        
        public function pipigaoxiao($url){
            preg_match('/post/(.*)/', $url, $id);
            $arr = json_decode($this->pipigaoxiao_curl($id[1]), true);
            $id = $arr["data"]["post"]["imgs"][0]["id"];
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'data' => array(
                    'title' => $arr["data"]["post"]["content"],
                    'cover' => 'https://file.ippzone.com/img/view/id/'.$arr["data"]["post"]["imgs"][0]["id"],
                    'url' => $arr["data"]["post"]["videos"]["$id"]["url"]
                )
            );
            return $arr;
        }
    
        public function quanminkge($url){
            preg_match('/?s=(.*)/',$url,$id);
            $text = $this->curl('https://kg.qq.com/node/play?s='.$id[1]);
            preg_match('/<title>(.*?)-(.*?)-/', $text, $video_title);
            preg_match('/cover":"(.*?)"/', $text, $video_cover);
            preg_match('/playurl_video":"(.*?)"/', $text, $video_url);
            preg_match('/{"activity_id":0,"avatar":"(.*?)"/', $text, $video_avatar);
            preg_match('/<p class="singer_more__time">(.*?)</p>/', $text, $video_time);
    
            $arr = array(
                'code' => 200,
                'msg' => '解析成功',
                'author' => $video_title[1],
                'avatar' => $video_avatar[1],
                'time' => $video_time[1],
                'data' => array(
                    'title' => $video_title[2],
                    'cover' => $video_cover[1],
                    'url' => $video_url[1],
                )
            );
            return $arr;
        }
    
        private function curl($url,$headers=[])
        {
            $header = 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');
            $con = curl_init((string)$url);
            curl_setopt($con,CURLOPT_HEADER,False);
            curl_setopt($con,CURLOPT_SSL_VERIFYPEER,False);
            curl_setopt($con,CURLOPT_RETURNTRANSFER,true);
            if (!empty($headers)) {
                curl_setopt($con,CURLOPT_HTTPHEADER,$headers);
            } else {
                curl_setopt($con,CURLOPT_HTTPHEADER,$header);
            }
            curl_setopt($con,CURLOPT_TIMEOUT,5000);
            $result = curl_exec($con);
            return $result;
        }
    
        private function post_curl($url, $post_data)
        {
            $postdata = http_build_query($post_data);
            $options = array('http' => array(
                'method' => 'POST',
                'content' => $postdata,
            ));
            $context = stream_context_create($options);
            $result = @file_get_contents($url, false, $context);
            return $result;
        }
    
        private function pipigaoxiao_curl($id)
        {
            $post_data = "{"pid":" . $id . ","type":"post","mid":null}";
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, "http://share.ippzone.com/ppapi/share/fetch_content");
            curl_setopt($ch, CURLOPT_REFERER, "http://share.ippzone.com/ppapi/share/fetch_content");
            curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36");
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
            curl_setopt($ch, CURLOPT_TIMEOUT, 5);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
            $output = curl_exec($ch);
            curl_close($ch);
            return $output;
        }
    
    }
    

    请求实例:

    • https://你的域名/?url=

    返回数据:

    字段名 说明 字段名 说明 字段名 说明 字段名 说明
    author 视频作者 avatar 作者头像 like 视频点赞量 time 视频发布时间
    title 视频标题 cover 视频封面 url 视频无水印链接 sex 作者性别
    age 作者年龄 city 所在城市 uid 作者id code 状态码
    1. 本站所有商业源码均为正版商业系统,需通过本平台或其他合作平台下载,且需授权才能使用!
    2. 本站所有开源源码、模板、插件、素材资源,均来自网络收集及网友分享,均可免费下载
    3. 本站所有开源源码、模板、插件、素材资源,仅限学习研究使用,版权归原作者所有!
    4. 本站提供提供个性化需求定制开发,如源码修改、美化、功能定制服务!

    锦毅商业源码网 » PHP源码短视频去水印解析源码附详细算法