Daum

2017-6-26 admin Code

<?php
/**
 *
 * Daum解析
 *
 * @author     apiicc
 * @date       2017-05-01 11:19:22
 * @version    1.0
 *
 * 严重警告:
 * 1、源码仅供学习交流使用。
 * 2、禁止用于危害官方利益的行为。
 * 3、禁止用于违反法律法规的行为。
 *
 *
 */
error_reporting(0);
header('Content-type: text/json;charset=utf-8');
$ui = array();
foreach($_GET as $key => $value){
    $ui[$key] = trim($value);
}
if( empty($ui['vid']) ){
    die('Please attach relevant parameters!');
}
 
$vid = $ui['vid'];
 
$ids = array('LOW','BASE','MAIN','HIGH');
 
$stream_type = array(
    'LOW'   => '240',
    'BASE'  => '360',
    'MAIN'  => '360+',
    'HIGH'  => '720p',
    'HIGH4'  => '1080p',
);
 
foreach( $ids as $i=>$row ){
    $in = json_decode(file_get_contents("http://videofarm.daum.net/controller/api/closed/v1_2/IntegratedMovieData.json?vid={$vid}&dteType=PC&profile={$row}"),true);
    $f[$stream_type[$row]] = $in['location']['url'];
}
 
if( !$in['msg'] ){
    $printr = array('status' => '200', 'msg' => 'success', 'data' => $f);
}else{
    $printr = array('status' => '0', 'msg' => 'ㄟ( ▔, ▔ )ㄏ,参数错误');
}
 
print_r( $printr );

标签: php Daum

发表评论:

Powered by emlog