|
Ç°ÑÔµ±ÎÒ¿´Æ¤Æ¤ÏºÏë°áÔË£¨Íµ£©ÊÓƵʱºò£¬ÊÓƵÀïÃæµÄˮӡÈÃÎÒºÜÞÏÞΣ¬ÀÏ»°ËµµÃºÃ×Ô¼º¶¯ÊÖ·áÒÂ×ãʳ£¬µ±È»ÊÇ˵¸É¾Í¸É£¬ÎÒÒ²ÊǵÚÒ»´Î³¢ÊÔдÕâ¸öȥˮӡµÄ½Ó¿Ú£¬Ö®Ç°¶¼ÊÇÓñðÈ˵Ľӿڣ¬±ðÈËÒ»ÅÜ·ÎҾ͵ÃÖØÐÂÑ°ÕÒ£¬½ñÌì¾ÍÇÚ¿ìÒ»´Î£¬Ö÷ÒªÊÇÎÒÏÖÔÚÿÌìºÜÏÐ
¿ªÊ¼»ñÈ¡Á´½Ó
µÃµ½¶ÌÁ´½Ó
https://h5.pipix.com/s/JjyWG38/
¸´ÖÆ´úÂë
ä¯ÀÀÆ÷·ÃÎÊ
¿ÉÒÔ¿´³öÕâ¸ö¶ÌÁ´½Ó×öÁË302Ìøת£¬µØÖ·ÔÚheadersÖÐ
https://h5.pipix.com/item/6854552706657294607?app_id=1319&app=super&timestamp=1596359053&user_id=63284301595&carrier_region=cn&region=cn&language=zh&utm_source=weixin
¸´ÖÆ´úÂë
F12´ó·¨ÕÒµ½ÁË£¬ÕÒÕâ¸ö¾Í¿´Óë302ÌøתµÄÁ´½ÓÓÐʲôÏàͬµÄµØ·½
https://h5.pipix.com/bds/webapi/item/detail/?item_id=6854552706657294607
¸´ÖÆ´úÂë
·ÖÎöjson´úÂëÌ«³¤Îҷŵ½×îºó£¬Ö÷ÒªÊÇÎÒÃÇ×ö½Ó¿Ú»ñÈ¡µÄÐÅÏ¢±ØÐëÕÒµ½£¬ÀýÈç×÷ÕßÃû³Æ£¬ÊÓƵÀïÃæµÄÎÄ×Ö£¬»¹ÓÐÊÓƵÁ´½Ó
$ppx['name'] = $json->item->author->name; //»ñÈ¡×÷ÕßÃû³Æ
$ppx['content'] = $json->item->content; //»ñÈ¡ÎÄ×ÖÄÚÈÝ
$ppx['url'] = $json->item->origin_video_download->url_list[0]->url; //»ñÈ¡ÊÓƵÁ´½Ó
¸´ÖÆ´úÂë
PHP²Ù×÷»ñÈ¡302ÌøתµØÖ·ºÍÊÓƵid
function getrealurl($url)
{
@$header = get_headers($url,1);
if (strpos($header[0],'301') || strpos($header[0],'302')) {
if(is_array($header['location'])) {
return $header['location'][count($header['location'])-1];
}else{
return $header['location'];
}
}else {
return $url;
}
}
$url = "https://h5.pipix.com/s/JjyWG38/";
$ids = explode('/', parse_url(getrealurl($url))['path'])[2];
¸´ÖÆ´úÂë
curlÄ£Äâ·ÃÎÊ
function get_curl($url, $paras = array())
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
if ($paras['httpheader']) { // ÇëÇóÍ·
$httpheader=$paras['httpheader'];
}else{
$httpheader[] = "Accept:*/*";
$httpheader[] = "Accept-Encoding:gzip,deflate,sdch";
$httpheader[] = "Accept-Language:zh-CN,zh;q=0.8";
$httpheader[] = "Connection:close";
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
if ($paras['ctime']) { // Á¬½Ó³¬Ê±
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $paras['ctime']);
}
if ($paras['rtime']) { // ¶ÁÈ¡³¬Ê±
curl_setopt($ch, CURLOPT_TIMEOUT_MS, $paras['rtime']);
}
if ($paras['post']) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $paras['post']);
}
if ($paras['header']) {
curl_setopt($ch, CURLOPT_HEADER, true);
}
if ($paras['cookie']) {
curl_setopt($ch, CURLOPT_COOKIE, $paras['cookie']);
}
if ($paras['refer']) {
if ($paras['refer'] == 1) {
curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f=');
} else {
curl_setopt($ch, CURLOPT_REFERER, $paras['refer']);
}
}
if ($paras['ua']) {
curl_setopt($ch, CURLOPT_USERAGENT, $paras['ua']);
} else {
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");
}
if ($paras['nobody']) {
curl_setopt($ch, CURLOPT_NOBODY, 1);
}
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
$json = json_decode(get_curl('https://h5.pipix.com/bds/webapi/item/detail/?item_id='.$ids))->data;
¸´ÖÆ´úÂë
¿´¿´Ð§¹û
{
"code": 200,
"msg": "»ñÈ¡³É¹¦£¡",
"name": "Ö¹ÓÚÑÔÇé",
"content": "ÓжÔÏóÁ˸㻥ɾÕæû±ØÒª Äãµ¥ÉíµÄʱºòÎÒ¶¼¿´²»ÉÏÄã ÄãÓжÔÏóÁËÎÒ»¹ÄܲðÉ¢Ä㣿",
"url": "http://v3-ppx.ixigua.com/bd9bc81bd72fe920f6997888d954fc8f/5f26b58a/video/m/2204f179597aab34bcdae3bfd30458edcf611668c6c8000055ca67c1f631/?a=1319&br=3375&bt=1125&cr=0&cs=0&dr=3&ds=3&er=&l=202008021945530100140431501209D910&lr=&mime_type=video_mp4&qs=0&rc=am1zbzhtdW83djMzNWYzM0ApNDU1aWZMvMF4vNjIyLjM6Yw%3D%3D&vl=&vr="
}
¸´ÖÆ´úÂë
ÖÕ¼«´úÂë<?php
/**
* ѧÕßÀî
* https://handsl.cn
*/
header('Access-Control-Allow-Origin:*');
header('Content-type:application/json; charset=utf-8');
function getrealurl($url)
{
@$header = get_headers($url,1);
if (strpos($header[0],'301') || strpos($header[0],'302')) {
if(is_array($header['location'])) {
return $header['location'][count($header['location'])-1];
}else{
return $header['location'];
}
}else {
return $url;
}
}
function get_curl($url, $paras = array())
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
if ($paras['httpheader']) { // ÇëÇóÍ·
$httpheader=$paras['httpheader'];
}else{
$httpheader[] = "Accept:*/*";
$httpheader[] = "Accept-Encoding:gzip,deflate,sdch";
$httpheader[] = "Accept-Language:zh-CN,zh;q=0.8";
$httpheader[] = "Connection:close";
}
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
if ($paras['ctime']) { // Á¬½Ó³¬Ê±
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $paras['ctime']);
}
if ($paras['rtime']) { // ¶ÁÈ¡³¬Ê±
curl_setopt($ch, CURLOPT_TIMEOUT_MS, $paras['rtime']);
}
if ($paras['post']) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $paras['post']);
}
if ($paras['header']) {
curl_setopt($ch, CURLOPT_HEADER, true);
}
if ($paras['cookie']) {
curl_setopt($ch, CURLOPT_COOKIE, $paras['cookie']);
}
if ($paras['refer']) {
if ($paras['refer'] == 1) {
curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f=');
} else {
curl_setopt($ch, CURLOPT_REFERER, $paras['refer']);
}
}
if ($paras['ua']) {
curl_setopt($ch, CURLOPT_USERAGENT, $paras['ua']);
} else {
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");
}
if ($paras['nobody']) {
curl_setopt($ch, CURLOPT_NOBODY, 1);
}
curl_setopt($ch, CURLOPT_ENCODING, "gzip");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
$url = "https://h5.pipix.com/s/JjyWG38/";
$ids = explode('/', parse_url(getrealurl($url))['path'])[2];
$json = json_decode(get_curl('https://h5.pipix.com/bds/webapi/item/detail/?item_id='.$ids))->data;
$ppx['code'] = 200;
$ppx['msg'] = "»ñÈ¡³É¹¦£¡";
$ppx['name'] = $json->item->author->name; //»ñÈ¡×÷ÕßÃû³Æ
$ppx['content'] = $json->item->content; //»ñÈ¡ÎÄ×ÖÄÚÈÝ
$ppx['url'] = $json->item->origin_video_download->url_list[0]->url; //»ñÈ¡ÊÓƵÁ´½Ó
exit(stripslashes(json_encode($ppx,JSON_UNESCAPED_UNICODE)));
¸´ÖÆ´úÂë
ÎÒÄǸö¿´¿´Ð§¹ûÀïÃæµÄÁ´½ÓÖмäÈÃÎÒɾµôһС²¿·Ö£¬ºÃÏñÊÇÁ´½ÓÀïÃæÓÐÒ»¶ÎÓ¢ÎÄÎ¥¹æ°É
|
|