예제 #1
0
 /**
  * Get URL video for Got-tv.ru site
  *
  * @param  string $nameVideo
  * @param  string $urlVideo
  * @return string|FALSE //url or ERROR
  */
 private function _getGodtvURL($nameVideo, $urlVideo)
 {
     $result = FALSE;
     $suffix = '.godtv.ru:85';
     $config = array();
     $strBox = new Default_Plugin_String();
     //-------------------
     // Получим URL страницы загрузки видео
     $encodeNameVideo = urlencode($nameVideo);
     $url = "http://god-tv.ru/" . $encodeNameVideo;
     try {
         $http = new Default_Plugin_HttpBox($config);
         $page = $http->get($url);
         foreach ($page->links() as $link) {
             $href = $link->getAttribute('href');
             $strBox->set($href);
             //                if ($strBox->indexOf($suffix) !== FALSE && $strBox->indexOf($urlVideo) !== FALSE) {
             //                    $result = $strBox->get();
             //                }
             if ($strBox->indexOf($suffix) !== FALSE) {
                 if ($strBox->indexOf($urlVideo) !== FALSE) {
                     $result = $strBox->get();
                 }
             }
         }
         if ($result === FALSE) {
             $html = $page->html;
         }
     } catch (Exception $exc) {
         return FALSE;
     }
     return $result;
 }