/** * Generate links with megaupload premium account, ORIGINAL LINK, NOT FLV * * @param String $megavideo_id * @return String Url, false if not found */ public static function generateMegavideoPremiumLink($megavideo_id) { //Get megavideo original link download $link = "http://www.megavideo.com/xml/player_login.php?u=" . MEGAUPLOAD_COOKIE . "&v=" . $megavideo_id; $content = file_get_contents($link); //Check for premium account if (strstr($content, 'type="premium"')) { //Get direct download link $downloadurl = strstr($content, "downloadurl="); $downloadurl = substr($downloadurl, 13, strpos($downloadurl, '" ') - 13); if ($downloadurl) { $downloadurl = urldecode($downloadurl); $downloadurl = html_entity_decode($downloadurl); //Get enclosure mimetype $videoType = VideoUtil::getEnclosureMimetype($downloadurl); //Get file name $filename = substr(strrchr($downloadurl, "/"), 1); return array($filename, $downloadurl, $videoType); } //Check another method for megavideo.com/?d links $megauploadArray = VideoUtil::generateMegauploadPremiumLink($megavideo_id); if ($megauploadArray && $megauploadArray != null) { return $megauploadArray; } } }
/** * Show link details and check links. */ private function showPlaylistLink() { echo ' <table width="100%" cellpadding="0" cellspacing="0" border="0">' . "\n"; echo ' <tr>' . "\n"; echo ' <td style="vertical-align:top;">' . "\n"; echo ' <img width="134px" height="193px" src="' . $this->playlistLink->getThumbnail() . '" style="border:0px;" />' . "\n"; echo ' <p>' . htmlentities($this->playlistLink->getFormat()) . '</p>' . "\n"; echo ' <p>' . htmlentities($this->playlistLink->getLanguage()) . '</p>' . "\n"; echo ' <p>' . htmlentities($this->playlistLink->getTypeDescription()) . '</p>' . "\n"; echo ' </td>' . "\n"; echo ' <td style="vertical-align:top;">' . "\n"; echo ' <p style="font-weight:bold;">' . htmlentities($this->playlistLink->getTitle()) . '</p>' . "\n"; echo ' <p style="text-align:justify;">' . htmlentities($this->playlistLink->getDescription()) . '</p>' . "\n"; echo ' </td>' . "\n"; echo ' </tr>' . "\n"; $itemid = 1; switch ($this->playlistLink->getType()) { case PlaylistLink::TYPE_MEGAUPLOAD: //------------------------------ foreach ($this->playlistLink->getIds() as $order => $id) { $arrayValue = VideoUtil::generateMegauploadPremiumLink($id); echo ' <tr>' . "\n"; echo ' <td align="top" colspan="2">' . "\n"; if ($arrayValue) { echo ' Link ' . $itemid . ': <a href="' . $arrayValue[1] . '">' . $arrayValue[0] . '</a>. Source: <a target="_blank" href="http://www.megaupload.com/?d=' . $id . '"><img width="22px" height="22px" src="../resources/playlist/view.png" style="border:0px;" /></a>' . "\n"; } else { echo ' Link error: <a href="http://www.megaupload.com/?d=' . $id . '">http://www.megaupload.com/?d=' . $id . '</a>' . "\n"; } echo ' </td>' . "\n"; echo ' </tr>' . "\n"; ++$itemid; } break; case PlaylistLink::TYPE_MEGAVIDEO: //------------------------------- foreach ($this->playlistLink->getIds() as $order => $id) { $arrayValue = VideoUtil::generateMegavideoPremiumLink($id); echo ' <tr>' . "\n"; echo ' <td align="top" colspan="2">' . "\n"; if ($arrayValue) { echo ' Link ' . $itemid . ': <a href="' . $arrayValue[1] . '">' . $arrayValue[0] . '</a>. Source: <a target="_blank" href="http://www.megavideo.com/?v=' . $id . '"><img width="22px" height="22px" src="../resources/playlist/view.png" style="border:0px;" /></a>' . "\n"; } else { echo ' Link error: <a href="http://www.megavideo.com/?v=' . $id . '">http://www.megavideo.com/?v=' . $id . '</a>' . "\n"; } echo ' </td>' . "\n"; echo ' </tr>' . "\n"; ++$itemid; } break; default: //--------------------------------------------------------- break; } echo ' </table>' . "\n"; }
/** * Prints first available movie link. */ function printMovieAutoLink($url) { $content = file_get_contents($url); $newlines = array("\t", "\n", "\r", " ", "", "\v"); $content = str_replace($newlines, "", utf8_decode($content)); if (strpos($content, "http://www.megavideo.com/v")) { $regex = "|www.megavideo.com\\/v\\/(.*)\"|U"; } else { if (strpos($content, "&v=")) { $regex = "|\\&v\\=(.*)\"|U"; } else { $regex = false; } } if ($regex) { preg_match_all($regex, $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $value) { //Get megavideo id if (count_chars($value) > 20) { $megavideo_id = substr($value, 0, -32); } else { $megavideo_id = $value; } if (COOKIE_STATE_ACTIVATED && $megavideo_id) { $array = VideoUtil::generateMegavideoPremiumLink($megavideo_id); if ($array) { echo $array[1]; return; } } } } } //Get megaupload links if (strpos($content, "www.megaupload.com/?d=")) { preg_match_all("|www\\.megaupload\\.com\\/\\?d\\=(.*)\\s?\" class\\=\"Stylehopbleu\"|U", $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $megaupload_id) { if (COOKIE_STATE_ACTIVATED) { $array = VideoUtil::generateMegauploadPremiumLink($megaupload_id); if ($array) { echo $array[1]; return; } } } } } echo "ERROR"; }
/** * Show template. */ public function showTemplate() { header("Content-type: text/xml"); echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n"; echo '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://purl.org/dc/elements/1.1/">' . "\n"; $this->showHeader(); echo ' <channel>' . "\n"; echo ' <title>' . $this->title . '</title>' . "\n"; $itemid = 0; switch ($this->playlistLink->getType()) { case PlaylistLink::TYPE_MEGAUPLOAD: //------------------------------ foreach ($this->playlistLink->getIds() as $order => $id) { $arrayValue = VideoUtil::generateMegauploadPremiumLink($id); if ($arrayValue) { echo $this->getPlaylistItem($arrayValue[0], $this->playlistLink->getDescription(), $this->playlistLink->getThumbnail(), $arrayValue[1], $arrayValue[2], $itemid); ++$itemid; } } break; case PlaylistLink::TYPE_MEGAVIDEO: //------------------------------- foreach ($this->playlistLink->getIds() as $order => $id) { $arrayValue = VideoUtil::generateMegavideoPremiumLink($id); if ($arrayValue) { echo $this->getPlaylistItem($arrayValue[0], $this->playlistLink->getDescription(), $this->playlistLink->getThumbnail(), $arrayValue[1], $arrayValue[2], $itemid); ++$itemid; } } break; default: //--------------------------------------------------------- break; } echo ' </channel>' . "\n"; echo '</rss>'; }
function fetchPlaySources($type, $play) { $template = new CinetubeTemplate(); $template->setType($type); //Check for session info if (isset($_SESSION["cinetubeTitle"])) { $movieTitle = $_SESSION["cinetubeTitle"]; $description = $_SESSION["cinetubeDescription"]; $image = $_SESSION["cinetubeImage"]; $template->setMovieTitle($movieTitle); $template->setDescription($description); $template->setImage($image); } $content = file_get_contents("http://www.cinetube.es" . $play); //Get megavideo links if (strpos($content, "www.megavideo.com/?v=")) { preg_match_all("|www\\.megavideo\\.com\\/\\?v\\=(.*)\"|U", $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $megavideo_id) { if (COOKIE_STATE_ACTIVATED) { $array = VideoUtil::generateMegavideoPremiumLink($megavideo_id); if ($array) { //echo $megavideo_id; $template->addMediaItem($array[0], "", $array[1], "", $array[2]); } } } } } //Get megaupload links if (strpos($content, "www.megaupload.com/?d=")) { preg_match_all("|www\\.megaupload\\.com\\/\\?d\\=(.*)\"|U", $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $megaupload_id) { if (COOKIE_STATE_ACTIVATED) { $array = VideoUtil::generateMegauploadPremiumLink($megaupload_id); if ($array) { //echo $megavideo_id; $template->addMediaItem($array[0], "", $array[1], "", $array[2]); } } } } } $template->generateView(CinetubeTemplate::VIEW_PLAY, ""); }
function fetchPlaySources($type, $play) { $template = new CinetubeAnimeTemplate(); $template->setType($type); $content = file_get_contents("http://www.cinetube.es" . $play); //Get megavideo links if (strpos($content, "www.megavideo.com/?v=")) { preg_match_all("|www\\.megavideo\\.com\\/\\?v\\=(.*)\"|U", $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $megavideo_id) { if (COOKIE_STATE_ACTIVATED) { $array = VideoUtil::generateMegavideoPremiumLink($megavideo_id); if ($array) { //echo $megavideo_id; $template->addMediaItem($array[0], "", $array[1], "", $array[2]); } } } } } //Get megaupload links if (strpos($content, "www.megaupload.com/?d=")) { preg_match_all("|www\\.megaupload\\.com\\/\\?d\\=(.*)\"|U", $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $megaupload_id) { if (COOKIE_STATE_ACTIVATED) { $array = VideoUtil::generateMegauploadPremiumLink($megaupload_id); if ($array) { //echo $megavideo_id; $template->addMediaItem($array[0], "", $array[1], "", $array[2]); } } } } } $template->generateView(CinetubeAnimeTemplate::VIEW_PLAY, ""); }
function fetchMovie($item, $title, $image) { $template = new KinostreamingTemplate(); $template->setMovieTitle($title); //Start session if (isset($_GET["PHPSESID"])) { session_id($_GET["PHPSESID"]); } session_start(); //Parse movie page $content = file_get_contents($item); $newlines = array("\t", "\n", "\r", " ", "", "\v"); $content = str_replace($newlines, "", utf8_decode($content)); if (strpos($content, "<strong>DESCRIPTION</strong>")) { $content = strstr($content, "<strong>DESCRIPTION</strong>"); $content = strstr($content, "<p>"); $description = substr($content, 0, strrpos($content, "</p>")); $description = str_replace("<p>", "", $description); $template->setDescription($description); } if (strpos($content, "http://www.megavideo.com/v")) { $regex = "|www.megavideo.com\\/v\\/(.*)\"|U"; } else { if (strpos($content, "&v=")) { $regex = "|\\&v\\=(.*)\"|U"; } else { $regex = false; } } if ($regex) { preg_match_all($regex, $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $value) { //Get megavideo id if (count_chars($value) > 20) { $megavideo_id = substr($value, 0, -32); } else { $megavideo_id = $value; } if (COOKIE_STATE_ACTIVATED && $megavideo_id) { $array = VideoUtil::generateMegavideoPremiumLink($megavideo_id); if ($array) { $template->addMediaItem($array[0], $description, $array[1], "", $array[2]); } } } } } //Get megaupload links if (strpos($content, "www.megaupload.com/?d=")) { preg_match_all("|www\\.megaupload\\.com\\/\\?d\\=(.*)\\s?\" class\\=\"Stylehopbleu\"|U", $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $megaupload_id) { if (COOKIE_STATE_ACTIVATED) { $array = VideoUtil::generateMegauploadPremiumLink($megaupload_id); if ($array) { //echo $megavideo_id; $template->addMediaItem($array[0], $description, $array[1], "", $array[2]); } } } } } $content = strstr($content, "yapb_cache/"); $image = "http://www.megavideolink.com/wp-content/uploads/" . substr($content, 0, strpos($content, '"')); $template->setImage($image); $template->generateView(KinostreamingTemplate::VIEW_MOVIE_DETAIL); }
function fetchSerieSeasonEpisodeLinks($type, $episodeLink, $episodeName, $seasonTitle) { //Init template $template = new MegavideolinkTemplate(); $template->setType($type); //recover session data $template->setSerieTitle($_SESSION["serieTitle"]); $template->setEpisodeTitle($episodeName); $template->setSeasonTitle($seasonTitle); $seasons = unserialize($_SESSION["seasonTitle"]); //Get page content $content = @file_get_contents($episodeLink); $newlines = array("\t", "\n", "\r", " ", "", "\v"); $content = str_replace($newlines, "", html_entity_decode(utf8_decode($content), ENT_QUOTES)); $_SESSION["megavideolinkLastReferer"] = $episodeLink; if (strpos($content, "<strong>DESCRIPTION</strong>")) { $content = strstr($content, "<strong>DESCRIPTION</strong>"); $content = strstr($content, "<p>"); $description = substr($content, 0, strpos($content, "</p>")); $description = str_replace("<p>", "", $description); $template->setDescription($description); } if (strpos($content, "http://www.megavideo.com/v")) { $regex = "|www.megavideo.com\\/v\\/(.*)\"|U"; } else { if (strpos($content, "&v=")) { $regex = "|\\&v\\=(.*)\"|U"; } else { $regex = false; } } if ($regex) { preg_match_all($regex, $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $value) { //Get megavideo id if (strlen($value) > 20) { $newValue = VideoUtil::separateMegavideoIdWithImage($value); $megavideo_id = $newValue[0]; } else { $megavideo_id = $value; } //Show real link if (COOKIE_STATE_ACTIVATED && $megavideo_id) { $array = VideoUtil::generateMegavideoPremiumLink($megavideo_id); if ($array) { $template->addMediaItem($array[0], $description, $array[1], $movieImage, $array[2]); } } } } } //Get megaupload links if (strpos($content, "www.megaupload.com/?d=")) { preg_match_all("|www\\.megaupload\\.com\\/\\?d\\=(.*)\\s?\"|U", $content, $links); if ($links && $links[1]) { $links = $links[1]; $links = array_unique($links); foreach ($links as $megaupload_id) { if (COOKIE_STATE_ACTIVATED) { $array = VideoUtil::generateMegauploadPremiumLink($megaupload_id); if ($array) { //echo $megavideo_id; $template->addMediaItem($array[0], $description, $array[1], "", $array[2]); } } } } } //Set cover image $template->setImage($_SESSION["serieCover"]); $template->generateView(MegavideolinkTemplate::VIEW_SERIE_EPISODE_LINK, $_SESSION["serieTitle"]); }