因为之前写过皮皮虾跟抖音的,所以尽量把市面上的小视频都搞定了
<?php
/**
* 获取火山小视频无水印下载
* @param string $url 火山小视频分享地址
* @return json
* @example 调用方法 例: echo huoshan('https://reflow.huoshan.com/hotsoon/s/yOCZCagw700/ ');
* @author Reaper <a@0oo.ren>
* @request https://www.52bz.la
*/
public function huoshan($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36');
$content = curl_exec($ch);
curl_close($ch);
$pattern = '/"video_id":"(.*?)"/';
preg_match($pattern, $content, $matches);
$data_url = 'http://hotsoon.snssdk.com/hotsoon/item/video/_playback/?video_id='.$matches[1];
$ch = curl_init($data_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36');
curl_exec($ch);
$newurl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
curl_close($ch);
$data = ['code' => 200, 'msg' => '获取成功!', 'download' => $newurl];
return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
下面是皮皮虾跟抖音的解析地址:
原创文章(代码),来之不易,转载请注明原著!