随机抓取新浪微博指定用户的小视频地址,标题,你问我用途,暂不明,没用上,分享一下。
搜资源/全网资源一网打尽www.souziyuan.top<?php $ids = [3881380517,2286908003,1752825395,2656274875,3266943013,1663072851]; $key = array_rand($ids); $id = $ids[$key]; $geturl = 'https://weibo.com/ajax/statuses/mymblog?uid=' . $id . '&page=1&feature=0'; $result = get_curl( $geturl ,0 ,'https://weibo.com/u/' . $id . '?lpage=profileRecom' ,'XSRF-TOKEN=HBrPLdHRfCgCoNaAJDVx6R5B; SUB=_2AkMTNC0Cf8NxqwFRmfgWy2PqZIxyyw3EieKlaNzZJRMxHRl-yT9vqnQCtRB6OLQD7VqVLExFvLzJRwLjpHYx1gN3b66X;' ,0 ,'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' ,0 ,0 ); $array = json_decode($result); $array->data->list[1]->page_info->object_type; //print_r($array->data->list[1]); if (!empty($array->data->list[1]->page_info->object_type) && $array->data->list[1]->page_info->object_type == 'video') { //print_r($array->data->list[1]->page_info->media_info); echo $array->data->list[1]->page_info->media_info->next_title; echo PHP_EOL; echo $array->data->list[1]->page_info->media_info->stream_url; } /*preg_match_all('/\"mp4_720p_mp4\":\"(.*?)\"/', $result, $matches); print_r($matches);*/ /*if (!empty($matches[1])) { $key = array_rand($matches[1]); $url = $matches[1][$key]; file_put_contents(__DIR__ . '/下载.mp4', get_curl($url)); }*/ function get_curl($url,$post=0,$referer=1,$cookie=0,$header=0,$ua=0,$nobaody=0,$addheader=0) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); $httpheader[] = "Accept: application/json"; //$httpheader[] = "Accept-Encoding: gzip,deflate,sdch"; $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8"; $httpheader[] = "Connection: close"; if($addheader){ $httpheader = array_merge($httpheader, $addheader); } curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader); if($post){ curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } if($header){ curl_setopt($ch, CURLOPT_HEADER, TRUE); } if($cookie){ curl_setopt($ch, CURLOPT_COOKIE, $cookie); } if($referer){ if($referer==1){ curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f='); }else{ curl_setopt($ch, CURLOPT_REFERER, $referer); } } if($ua){ curl_setopt($ch, CURLOPT_USERAGENT,$ua); }else{ curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Linux; U; Android 4.4.1; zh-cn) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.5 Mobile Safari/533.1'); } if($nobaody){ curl_setopt($ch, CURLOPT_NOBODY,1); } curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_ENCODING, "gzip"); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); $ret = curl_exec($ch); curl_close($ch); //$ret=mb_convert_encoding($ret, "UTF-8", "UTF-8"); return $ret; }
- THE END -
本站提供的资源,都来自网络,版权争议与本站无关,所有内容及软件的文章仅限用于学习和研究目的。不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,我们不保证内容的长久可用性,通过使用本站内容随之而来的风险与本站无关,您必须在下载后的24个小时之内,从您的电脑/手机中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。侵删请致信邮箱souziyuan@outlook.com
共有 0 条评论