快手热播榜前十排行榜API接口源码,调用的快手官方数据接口,返回热播榜前十的json格式数据。
<?php $header="User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0"; $options['http'] = array( 'method' => "GET", 'header' => $header); $context = stream_context_create($options); ini_set('allow_url_fopen','on'); ini_set('user_agent','Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'); $text = file_get_contents("https://www.kuaishou.com/",1,$context); preg_match_all('#<p class="rank-name" data-v-0b3dceae>([^"]*?)<#',$text,$name); preg_match_all('#<span class="hot-value" data-v-0b3dceae data-v-5d4cbc17>([^"]*?)</span>#',$text,$hot); $out = array( "top_1" => array( "name" => urldecode($name[1][0]), "hot" => $hot[1][0] ), "top_2" => array( "name" => $name[1][1], "hot" =>$hot[1][1] ), "top_3" => array( "name" => $name[1][2], "hot" => $hot[1][2] ), "top_4" => array( "name" => $name[1][3], "hot" =>$hot[1][3] ), "top_5" => array( "name" => $name[1][4], "hot" => $hot[1][4] ), "top_6" => array( "name" => $name[1][5], "hot" => $hot[1][5] ), "top_7" => array( "name" => $name[1][6], "hot" => $hot[1][6] ), "top_8" => array( "name" => $name[1][7], "hot" => $hot[1][7] ),"top_9" => array( "name" => $name[1][8], "hot" => $hot[1][8] ),"top_10" => array( "name" =>$name[1][9], "hot" => $hot[1][9] )); #$out = str_replace("data-v-0b3dceae>",'',$out); #$wb ='<p class="rank-name" data-v-0b3dceae>abc</p>'; # $out=wb_qzj($wb,'<p class="rank-name" data-v-0b3dceae>','</p>'); header('Content-type:text/json'); echo json_encode($out,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
相关专题
API数据接口
2022-11-010API是开发中必不可少的知识点。API的合理应用可以大大节约开发成本。它收集了关于API接口的信息,包括API接口、API代码和API源代码,帮助你更快地学习和使用API技术。
- 网站Ping接口源码,IP地址+测速[2022-11-17]
- 使用谷歌翻译API接口来制作伪原创的API接口源码-(制作伪原创接口)[2022-11-17]
- ICP备案信息查询API接口[2022-11-03]
- php联通查话费API接口源码[2022-11-03]