private function getAndroidVideoUrl($obj, $p_coding, $p_script) { //var_dump($obj); $videoAddressUrl = ""; if (!is_object($obj) || !is_object($obj->data)) { return true; } /* mp4 && m3u8 */ if (property_exists($obj->data, 'mpl')) { foreach ($obj->data->mpl as $mpl) { /* mp4 */ switch ($mpl->vd) { case 1: $strBody = getPageWindow($mpl->m4u, 'utf-8'); $videoAddressUrl .= MovieType::VIDEO_SEP_VERSION . MovieType::Liu_Chang . MovieType::VIDEO_NAME_URL_SEP . getBody($strBody, 'data:{"l":"', '"'); break; case 2: $strBody = getPageWindow($mpl->m4u, 'utf-8'); $videoAddressUrl .= MovieType::VIDEO_SEP_VERSION . MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . getBody($strBody, 'data:{"l":"', '"'); break; } } /* m3u8 */ foreach ($obj->data->mpl as $mpl) { switch ($mpl->vd) { case 1: $videoAddressUrl .= MovieType::VIDEO_SEP_VERSION . MovieType::Liu_Chang . MovieType::VIDEO_NAME_URL_SEP . $mpl->m3u; break; case 2: $videoAddressUrl .= MovieType::VIDEO_SEP_VERSION . MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $mpl->m3u; break; } } } /* m3u8 */ if (property_exists($obj->data, 'mtl')) { foreach ($obj->data->mtl as $mtl) { switch ($mtl->vd) { case 1: $videoAddressUrl .= MovieType::VIDEO_SEP_VERSION . MovieType::Liu_Chang . MovieType::VIDEO_NAME_URL_SEP . $mtl->m3u; break; case 2: $videoAddressUrl .= MovieType::VIDEO_SEP_VERSION . MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $mtl->m3u; break; case 3: $videoAddressUrl .= MovieType::VIDEO_SEP_VERSION . MovieType::TOP_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $mtl->m3u; break; } } } if (strpos($videoAddressUrl, "{mType}") !== false && strpos($videoAddressUrl, "{mType}") === 0) { $videoAddressUrl = substr($videoAddressUrl, 7); } writetofile("iqiyi.log", "down url:" . $videoAddressUrl); return $videoAddressUrl; }
public function parseIOSVideoUrlByContent($content, $p_coding, $p_script) { $videoUrlParam = getBody($content, $this->p_videocodeApiUrlParamstart, $this->p_videocodeApiUrlParamend); $videoUrlParam = replaceLine($videoUrlParam); // var_dump($videoUrlParam); $p_videoUrlApi = replaceStr($this->p_videocodeApiUrl, "{PROD_ID}", $videoUrlParam); $videoUrlApiCode = getPageWindow($p_videoUrlApi, $this->p_code); $videoAddressUrl = getBody($videoUrlApiCode, $this->p_videourlstart, $this->p_videourlend); return $videoAddressUrl; }
private function getAndroidVideoUrl($vid) { $videoAddressUrl = ""; $videoAddressUrl1 = ""; $videoAddressUrl2 = ""; $videoAddressUrl3 = ""; if (isset($vid) && !is_null($vid)) { $url = replaceStr(FengXingContent::BASE_URL, "{ID}", $vid); $mediaid = explode("/", $vid); $mediaid = $mediaid[0]; // var_dump($mediaid); $content = getPageWindow($url, "UTF-8"); try { $json = ContentProviderFactory::obj2arr(json_decode($content)); if (isset($json) && !is_null($json) && isset($json['playinfos']) && !is_null($json['playinfos'])) { $playinfos = $json['playinfos']; foreach ($playinfos as $playinfo) { $cid = $playinfo['cid']; $t_mediaid = $playinfo['mediaid']; if ($t_mediaid !== $mediaid) { continue; } $clarity = $playinfo['clarity']; $byterate = $playinfo['byterate']; $tempUrl = replaceStr(FengXingContent::BASE_URL_MP3, "{cid}", $cid); $tempUrl = replaceStr($tempUrl, "{byterate}", $byterate); $tempjson = ContentProviderFactory::obj2arr(json_decode(getPageWindow($tempUrl, "UTF-8"))); if (isset($tempjson) && !is_null($tempjson) && isset($tempjson['playlist']) && !is_null($tempjson['playlist']) && isset($tempjson['playlist'][0]) && !is_null($tempjson['playlist'][0]) && isset($tempjson['playlist'][0]['urls']) && !is_null($tempjson['playlist'][0]['urls'])) { $rc = false; foreach ($tempjson['playlist'][0]['urls'] as $location) { if ($clarity === "high-dvd") { if ($rc || !isN($videoAddressUrl3)) { $videoAddressUrl3 = $videoAddressUrl3 . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl3 = $videoAddressUrl3 . MovieType::TOP_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $location; $rc = true; } if ($clarity === "dvd") { if ($rc || !isN($videoAddressUrl2)) { $videoAddressUrl2 = $videoAddressUrl2 . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl2 = $videoAddressUrl2 . MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $location; $rc = true; } if ($clarity === "tv") { if ($rc || !isN($videoAddressUrl1)) { $videoAddressUrl1 = $videoAddressUrl1 . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl1 = $videoAddressUrl1 . MovieType::NORMAL . MovieType::VIDEO_NAME_URL_SEP . $location; $rc = true; } } } } } // var_dump($videoAddressUrl3); // var_dump($videoAddressUrl1); // var_dump($videoAddressUrl2); } catch (Exception $e) { } } $flag = false; if (!isN($videoAddressUrl3)) { if ($flag) { $videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl = $videoAddressUrl . $videoAddressUrl3; $flag = true; } if (!isN($videoAddressUrl2)) { if ($flag) { $videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl = $videoAddressUrl . $videoAddressUrl2; $flag = true; } if (!isN($videoAddressUrl1)) { if ($flag) { $videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl = $videoAddressUrl . $videoAddressUrl1; $flag = true; } // var_dump($videoAddressUrl); return $videoAddressUrl; }
public function getReviewsByStar($url) { writetofile("updateReview.txt", 'getReviewsById for vod url{=}' . $url); $content = getPageWindow($url, "utf-8"); // $content=getBodys($content, '<div id="content">');var_dump($content); writetofile("updateReviewContent.txt", 'getReviewsById for vod url{=}' . $url); writetofile("updateReviewContent.txt", 'getReviewsById for vod url{=}' . $content); if (isset($content) && !is_null($content)) { $reviewArry = array(); $titleArry = array(); $idArry = array(); $titlesID = getArray($content, '<a target="_blank" title', 'onclick="moreurl(this'); $titles = getArray($titlesID, '="', '"href="http://movie.douban.com/review'); $reviewids = getArray($titlesID, "/review/", "/\""); $reviewidsArray = split('{Array}', $reviewids); $titlesArray = split('{Array}', $titles); $count = count($reviewidsArray); for ($i = 0; $i < $count && $i < 3; $i++) { $tempUrl = 'http://movie.douban.com/j/review/' . $reviewidsArray[$i] . '/fullinfo?show_works=False'; //var_dump($tempUrl); writetofile("updateReview.txt", 'getReviewsById for vod url{=}' . $tempUrl); $tempContent = getPage($tempUrl, "utf-8"); $review = getBody($tempContent, "\"html\":\"", "<div class="); //"html":" writetofile("updateReviewContent.txt", 'getReviews' . $review); $review = replaceStr($review, "\\r<br\\/>", Chr(13)); if (!isN($review)) { $reviewArry[] = $review; $titleArry[] = $titlesArray[$i]; $idArry[] = $reviewidsArray[$i]; } } if (count($reviewArry) > 0) { return array('comments' => $reviewArry, 'title' => $titleArry, 'reviewid' => $idArry); } else { return false; } } return false; }
public static function checkHtmlCanPlay($providerName, $url) { if (!isset($providerName) || is_null($providerName) || $providerName === 'no') { return true; } if (ContentProviderFactory::YOU_KU === $providerName) { $judgeContent = ContentProviderFactory::YOU_KU_CAN_PLAY_CONTENT; $content = getPage($url, 'utf-8'); } else { if (ContentProviderFactory::TU_DOU === $providerName) { $judgeContent = ContentProviderFactory::TU_DOU_CAN_PLAY_CONTENT; $content = getPage($url, 'gbk'); } else { if (ContentProviderFactory::PPTV === $providerName) { $judgeContent = ContentProviderFactory::PPTV_CAN_PLAY_CONTENT; $content = getPage($url, 'utf-8'); } else { if (ContentProviderFactory::LETV === $providerName) { $judgeContent = ContentProviderFactory::LETV_CAN_PLAY_CONTENT; $content = getPage($url, 'utf-8'); } else { if (ContentProviderFactory::Wl_56 === $providerName) { $judgeContent = ContentProviderFactory::Wl_56_CAN_PLAY_CONTENT; $content = getPage($url, 'utf-8'); } else { if (ContentProviderFactory::FENG_XING === $providerName) { $judgeContent = ContentProviderFactory::FENG_XING_CAN_PLAY_CONTENT; $content = getPageWindow($url, 'utf-8'); } else { if (ContentProviderFactory::QQ === $providerName) { $judgeContent = ContentProviderFactory::QQ_CAN_PLAY_CONTENT; $content = getPage($url, 'utf-8'); } else { if (ContentProviderFactory::SOHU === $providerName) { $judgeContent = ContentProviderFactory::SOHU_CAN_PLAY_CONTENT; //http://tv.sohu.com/20121126/n3587206433333335.shtml $content = getPage($url, 'GBK'); } else { if (ContentProviderFactory::SINA === $providerName) { $judgeContent = ContentProviderFactory::SINA_CAN_PLAY_CONTENT; $content = getPage($url, 'utf-8'); if (isset($content) && !is_null($content) && strpos($content, "对不起,这个页面已经木有啦") === false) { // return true; } else { return false; } } else { if (ContentProviderFactory::QI_YI === $providerName) { $judgeContent = ContentProviderFactory::QI_YI_CAN_PLAY_CONTENT; $content = getPage($url, 'utf-8'); } else { if (ContentProviderFactory::TANG_DOU === $providerName) { $judgeContent = ContentProviderFactory::TANG_DOU_CAN_PLAY_CONTENT; $content = getPage($url, 'utf-8'); } else { return true; } } } } } } } } } } } // var_dump($content); // writetofile("d:\\canhl.txt", $content); if (isset($content) && !is_null($content) && strpos($content, $judgeContent) === false) { return true; } else { return false; } return false; }
private function getAndroidVideoUrl($vid, $p_coding, $p_script) { $videoAddressUrl = ""; $videoAddressUrl1 = ""; $videoAddressUrl2 = ""; $videoAddressUrl3 = ""; $videoAddressUrl4 = ""; $videoTyps = ""; if (isset($vid) && !is_null($vid)) { $url = replaceStr(TudouContent::BASE_URL, "{id}", $vid); // var_dump($url); $pageCode = getPageWindow($url, $this->p_code); $downUrls = getArray($pageCode, $this->htmlparmStart, $this->htmlparaend); $downArray = explode("{Array}", $downUrls); for ($i = 0; $i < count($downArray); $i++) { $tempUrl = $downArray[$i]; // var_dump($tempUrl) ; if (strpos($tempUrl, "codetype=5") !== false && strpos($videoTyps, "codetype=5") === false) { // $location = getLocation($this->downloadUrl.replaceStr($tempUrl,"&","&")); // if(!isN($location) && strpos($location, $this->notfound) ===false){ // $videoAddressUrl4=MovieType::TOP_CLEAR.MovieType::VIDEO_NAME_URL_SEP.$location; // $videoTyps=$videoTyps."codetype=5"; // } $location = $this->getRealUrls($tempUrl); if ($location !== false && !isN($location)) { $videoAddressUrl4 = MovieType::TOP_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $location; $videoTyps = $videoTyps . "codetype=5"; } } if (strpos($tempUrl, "codetype=3") !== false && strpos($videoTyps, "codetype=3") === false) { // $location = getLocation($this->downloadUrl.replaceStr($tempUrl,"&","&")); // if(!isN($location) && strpos($location, $this->notfound) ===false){ $location = $this->getRealUrls($tempUrl); if ($location !== false && !isN($location)) { $videoAddressUrl3 = MovieType::HIGH_CLEAR . MovieType::VIDEO_NAME_URL_SEP . $location; $videoTyps = $videoTyps . "codetype=3"; } } if (strpos($tempUrl, "codetype=2") !== false && strpos($videoTyps, "codetype=2") === false) { // $location = getLocation($this->downloadUrl.replaceStr($tempUrl,"&","&")); // if(!isN($location) && strpos($location, $this->notfound) ===false){ $location = $this->getRealUrls($tempUrl); if ($location !== false && !isN($location)) { $videoAddressUrl2 = MovieType::NORMAL . MovieType::VIDEO_NAME_URL_SEP . $location; $videoTyps = $videoTyps . "codetype=2"; } } if (strpos($tempUrl, "codetype=1") !== false && strpos($videoTyps, "codetype=1") === false) { // $location = getLocation($this->downloadUrl.replaceStr($tempUrl,"&","&")); // if(!isN($location) && strpos($location, $this->notfound) ===false){ $location = $this->getRealUrls($tempUrl); if ($location !== false && !isN($location)) { $videoAddressUrl1 = MovieType::Liu_Chang . MovieType::VIDEO_NAME_URL_SEP . $location; $videoTyps = $videoTyps . "codetype=1"; } } // var_dump($videoTyps) ; } $flag = false; if (!isN($videoAddressUrl4)) { $videoAddressUrl = $videoAddressUrl . $videoAddressUrl4; $flag = true; } if (!isN($videoAddressUrl3)) { if ($flag) { $videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl = $videoAddressUrl . $videoAddressUrl3; $flag = true; } if (!isN($videoAddressUrl2)) { if ($flag) { $videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl = $videoAddressUrl . $videoAddressUrl2; $flag = true; } if (!isN($videoAddressUrl1)) { if ($flag) { $videoAddressUrl = $videoAddressUrl . MovieType::VIDEO_SEP_VERSION; } $videoAddressUrl = $videoAddressUrl . $videoAddressUrl1; $flag = true; } } return $videoAddressUrl; }
function getUrl($url) { $content = getPageWindow($url, $this->p_code); $contentObj = json_decode($content); if (is_object($contentObj) && property_exists($contentObj, 'location')) { return $contentObj->location; } }