<?php
set_time_limit(0);
require '../global.php';
header("Content-type: text/html; charset=utf-8");
L::loadClass('phpQuery' , 'utility' , false);
$url = S::getGP('url');
$vodID = getYoukuID($url);
phpQuery::$documents = null;
phpQuery::$defaultCharset = 'GBK';
phpQuery::newDocumentFileHTML($url);
echo pq("title")->html();
$num = (int) pq("#zySeriesTab")->find('li')->length();
$num = $num>0 ? $num : 1;
echo '<pre>';
for($i=0;$i<$num;$i++){
$key = ($i*40)+1;
$reload = "reload_".$key;
$juji = "http://www.youku.com/show_episode/id_{$vodID}.html?dt=json&divid={$reload}";
$data = getJuJI($juji);
foreach($data as $value){
echo $value."\n";
}
}
echo '</pre>';
function getYoukuID($url)
{
preg_match("~id_(.*).html~", $url,$arr);
return $arr[1];
}
function getJuJI($juji)
{
phpQuery::$documents = null;
phpQuery::$defaultCharset = 'utf-8';
//$content = file_get_contents($juji);
//phpQuery::newDocumentHTML($content);
phpQuery::newDocumentFileHTML($juji);
$aList = pq("a");
foreach ($aList as $a)
{
$key =getYoukuID(pq($a)->attr('href'));
$value = pq($a)->html();
$data[] ="第{$value}集\${$key}";
}
return $data;
} 采集结果: 用于: :