美拍解析源码
- echo json_encode(MeiPai::parse($url));
- /**
- *
- */
- class MeiPai
- {
- public static function parse($url){
- $content = self::curl($url);
- preg_match('#
(.*?) #’,$content,$_title); - preg_match('#“(.*?)” property=“og:image”>#’,$content,$_img);
- preg_match('#data-video=“(.*?)”#’,$content,$_video);
- $vurl = self::decode($_video[1]);
- $videoinfo[“poster”] = $_img[1];
- $videoinfo['code’] = 200;
- $videoinfo[“data”][“url”] = $vurl;
- $videoinfo[“play”] = “h5mp4″;
- return $videoinfo;
- }
- public static function decode($string){
- $hex = str_split(hexdec(implode(array_Reverse(str_split(substr($string,0,4))))));
- $splt1 = $hex[0];
- $size1 = $hex[1];
- $size2 = $hex[3];
- $str = substr($string,4);
- $first = substr($str,0,$splt1).substr($str,$splt1+$size1);
- $splt2 = strlen($first) – ($hex[2]) – $size2;
- $second = substr($first,0,$splt2).substr($first,$splt2+$size2);
- return base64_decode($second);
- }
- public static function curl($url)
- {
- $params[“ua”] = “Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36″;
- return GlobalBase::curl($url,$params);
- }
- }
- ?>
下载仅供下载体验和测试学习,不得商用和正当使用。
[ppwp passwords=”zhishitu.cn”]
下载体验
应版权要求,禁止分享,敬请谅解,有问题务必找客服哈。
有问题找客服哈,并领取学习福利!
[/ppwp]