function youtubeSearch($title) { $trailers = array(); $title = normalize($title); $trailerquery = $title . " trailer"; $youtubeurl = "http://gdata.youtube.com/feeds/api/videos?client=" . YOUTUBE_CLIENT_ID . "&key=" . YOUTUBE_DEVELOPER_KEY . "&v=2&" . "q=" . urlencode($trailerquery) . "&start-index=1&max-results=10"; $resp = httpClient($youtubeurl, true); if (!$resp['success']) { return $trailers; } $xml = simplexml_load_string($resp['data']); // obtain namespaces $namespaces = $xml->getNameSpaces(true); foreach ($xml->entry as $trailer) { $media = $trailer->children($namespaces['media']); $yt = $media->group->children($namespaces['yt']); $id = $yt->videoid; // API filtering code removed $trailers[] = array('id' => (string) $id, 'src' => (string) $trailer->content['src'], 'title' => (string) $trailer->title); if (count($trailers) >= 10) { break; } } return $trailers; }
function getContent($path) { $cont = null; if (preg_match("/^http:\\/\\//", $path)) { $path = rawurldecode($path); $t = explode("/", $path); for ($i = 3; $i < count($t); $i++) { $t[$i] = rawurlencode($t[$i]); } $path = implode("/", $t); $response = httpClient($path, 0, '', 15, null, "Referer: " . dirname($path) . "\r\n", false, false); if (preg_match("/^HTTP\\/1.\\d 30[12].*?\n/s", $response['header'])) { preg_match("/Location:\\s+(.*?)\n/s", $response['header'], $matches); if (!empty($matches[1])) { // get redirection target $location = trim($matches[1]); $response = httpClient($location, 0, '', 15, null, "Referer: " . dirname($location) . "\r\n", false, false); } } if (preg_match("/^.*? 200 .*?\n/s", $response['header'])) { $cont = $response['data']; } else { } } else { $cont = implode('', file($path)); } return $cont; }
/** * Search an image on Google * * Searches for a given title on the google and returns the found links in * an array * * @param string The search string * @return array Associative array with id and title */ function googleSearch($title) { global $CLIENTERROR; global $cache; $page = 1; $data = array(); $data['encoding'] = 'utf-8'; do { $url = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&rsz=large&q=" . urlencode($title) . "&start=" . count($data); $resp = httpClient($url, $cache); if (!$resp['success']) { $CLIENTERROR .= $resp['error'] . "\n"; } $json = json_decode($resp['data']); # dump($resp['data']); # dump($page); # dump($json); // prevent caching invalid responses if ($json->responseStatus != 200 && $cache) { $cache_file = cache_get_filename($url, CACHE_HTML); @unlink($cache_file); } foreach ($json->responseData->results as $row) { # dump($row); $res = array(); $res['title'] = $row->width . 'x' . $row->height; // width x height $res['imgsmall'] = $row->tbUrl; // small thumbnail url $res['coverurl'] = $row->url; // resulting target url $data[] = $res; } } while ($page++ < 3); # dump($data); return $data; }
// get list of all used images $SQL = 'SELECT * FROM ' . TBL_DATA; if (empty($wishlist)) { $SQL .= ' WHERE mediatype != ' . MEDIA_WISHLIST; } $result = runSQL($SQL); foreach ($result as $video) { if (empty($video['imdbID'])) { continue; } $engine = engineGetEngine($video['imdbID']); if ($engine == 'imdb') { echo "Fetching recommendations for {$video['title']} (IMDB Id {$video['imdbID']})<br/>\n"; flush(); $url = 'http://uk.imdb.com/title/tt' . $video['imdbID'] . '/recommendations'; $resp = httpClient($url, true); if (!$resp['success']) { echo $resp['error'] . "<br/>"; continue; } preg_match_all('#<a href="/title/tt(\\d+)/">(.+?)</a>#i', $resp['data'], $ary, PREG_SET_ORDER); foreach ($ary as $recommend) { $title = $recommend[2]; $id = $recommend[1]; if (preg_match('/<img/', $title)) { continue; } $rating = ''; if (preg_match("#{$id}.+?<b>(\\d+\\.\\d+)</b>#i", $resp['data'], $match)) { $rating = $match[1]; // matching at least required rating?
/** * Parses Actor-Details * * Find image and detail URL for actor, not sure if this can be made * a one-step process? * * @author Victor La <*****@*****.**> * @param string $name Name of the Actor * @return array array with Actor-URL and Thumbnail */ function filmwebActor($name, $actorid) { global $filmwebServer; // search directly by id or via name? $resp = httpClient(filmwebActorUrl($name, $actorid), 1); $ary = array(); if (preg_match('/<a class="searchResultTitle" href="(.+?)">/i', $resp['data'], $m)) { $resp = httpClient($m[1], true); } // now we should have loaded the best match if (preg_match('/<img src="http:\\/\\/gfx.filmweb.pl\\/p\\/(.+?)"/i', $resp['data'], $m)) { $ary[0][0] = 'http://gfx.filmweb.pl/p/' . $m[1]; $ary[0][1] = 'http://gfx.filmweb.pl/p/' . $m[1]; return $ary; } else { return null; } }
/** * Parses Actor-Details * * Find image and detail URL for actor, not sure if this can be made * a one-step process? Completion waiting on update of actor * functionality to support more than one engine. * * @author Douglas Mayle <*****@*****.**> * @author Andreas Goetz <*****@*****.**> * @param string $name Name of the Actor * @return array array with Actor-URL and Thumbnail */ function allocineActor($name, $actorid) { global $allocineServer; if (empty($actorid)) { return; } $url = 'http://www.allocine.fr/personne/fichepersonne_gen_cpersonne=' . urlencode($actorid) . '.html'; $resp = httpClient($url, 1); $single = array(); if (preg_match('/src="([^"]+allocine.fr\\/acmedia\\/medias\\/nmedia\\/[^"]+\\/[0-9]+\\.jpg)[^>]+width="120"/', $resp['data'], $single)) { $ary[0][0] = $url; $ary[0][1] = $single[1]; return $ary; } else { return null; } }
/** * Fetches the data for a given Amazon ID (equals ISBN) * * @author Andreas Goetz <*****@*****.**> * @param int IMDB-ID * @return array Result data */ function amazonawsData($id) { global $amazonAWSUrl, $cache; global $CLIENTERROR; $url = aws_signed_request(array('Operation' => 'ItemLookup', 'ItemId' => $id, 'ResponseGroup' => 'Large')); $resp = httpClient($url, $cache); # dump($resp); if ($resp['success']) { $xml = load_xml($resp['data']); # dump($xml); $data = awsNodeData($xml->Items->Item[0]); # dump($data); } else { $CLIENTERROR .= $resp['error'] . "\n"; } // utf-8 according to HTTP response but simplexml complains? // utf-8 is already forced by load_xml $data['encoding'] = 'utf-8'; return $data; }
function request($urlonly = false) { global $urlid, $url; // get or post? $pass = $_POST ? $_POST : $_GET; // don't use $_REQUEST or cookies will screw up the query foreach ($pass as $key => $value) { switch ($key) { case $urlid: $url = html_entity_decode(urldecode($value)); break; case session_name(): case 'videodbreload': case 'iframe': break; default: if ($request) { $request .= "&"; } $request .= "{$key}={$value}"; } } // going directly to trace.php without options? if (!$url) { $url = 'http://www.imdb.com'; } // remove session identifier before request is sent or caching will not work $url = preg_replace("/&" . SID . "\$/", "", $url); // workaround for fishy IMDB URLs $url = preg_replace("/\\&/", "&", $url); // don't fetch, just find target if ($urlonly) { return $url; } // append request parameters if ($_POST) { $post = $request; } elseif ($request) { $url .= "?" . $request; } // encode possible spaces, use %20 instead of + $url = preg_replace('/ /', '%20', $url); $response = httpClient($url, $_GET['videodbreload'] != 'Y', array('post' => $post)); // url after redirect get_base($response['url']); if ($response['success'] != true) { $page = 'Error: ' . $response['error']; if ($response['header']) { $page .= '<br/>Header:<br/>' . nl2br($response['header']); } } else { if (!$cache) { putHTTPcache($url . $post, $response); } $page = $response['data']; } return $page; }
* Add a DVD/Video to VideoDB via the barcode on the box * (c) 2004 GPL'd * * @package Contrib * @author Andrew Pritchard <*****@*****.**> * @version $Id: lookup_barcode.php,v 1.4 2007/09/08 09:17:16 andig2 Exp $ */ chdir('..'); require_once './core/functions.php'; $notFound = 0; if (isset($_GET['barcode'])) { // Base URL for the search $url = 'http://s1.amazon.co.uk/exec/varzea/sdp/sai-condition/'; // Add our post options and get the data $post = 'sdp-sai-asin=' . $_GET['barcode']; $amazon_data = httpClient($url, 0, $post); // If it succeeds.... if ($amazon_data['success'] == 1) { if (preg_match("/<b class=\"sans\">(.*)<\\/b>/", $amazon_data['data'], $matches)) { if ($matches[1] == 'Identify the exact item you&//039;re selling') { $notFound = 1; } else { $media_type = 1; $title = urlencode($matches[1]); if (preg_match("/http:\\/\\/www.amazon.co.uk\\/exec\\/obidos\\/ASIN\\/(.*)\\//", $amazon_data, $matches)) { $asin_number = "ASIN: {$matches['1']}"; } else { $asin_number = 'ASIN not found'; } if (preg_match("/alt=\"VHS\"/", $amazon_data['data'], $matches)) { $media_type = 6;
function googleSearch($title) { $googleServer = "http://images.google.com"; $resp = httpClient($googleServer . '/images?q=' . urlencode($title) . '&hl=ru&imgsz=small|medium|large|xlarge', 1); $result = array(); if (preg_match_all('{<a href="/imgres\\?imgurl=(.*?)&.*?&h=(\\d+)&w=(\\d+).*?<img[^>]*src=(.*?)[\\s>]}i', $resp['data'], $data, PREG_SET_ORDER)) { foreach ($data as $row) { $info = array(); $url = rawurldecode($row[1]); $info['coverurl'] = (preg_match('/^http/', $url) ? "" : "http://") . $url; // resulting target url $info['imgsmall'] = trim($row[4], '"\''); // small thumbnail url $info['w'] = $row[3]; // width $info['h'] = $row[2]; //height $result[] = $info; } } return $result; }
/** * Downloads an URL to the given local file * * @param string $url URL to download * @param string $local Full path to save to * @return bool true on succes else false */ function download($url, $local) { $resp = httpClient($url); if (!$resp['success']) { return false; } return @file_put_contents($local, $resp['data']) !== false; }
function fetchTomeInfos($url) { if (!stristr($url, 'http://')) { $url = 'http://www.tvtome.com/' . ucfirst($url) . '/'; } //Firstly, look up the episode lists. $eplist = $url . "eplist.html"; $ephome = $url . "index.html"; echo "Retrieving Episode List... "; flush(); $resp = httpClient($eplist, true); preg_match_all('/<tr align="center"><td align="right" valign=top class="small">.*?<\\/td><td nowrap valign=top class="small">(.*?)<\\/td><td valign=top class="small">.*?<\\/td><td valign=top align="right" class="small" nowrap>(.*?)<\\/td><td> <\\/td><td class="small" align="left" valign=top><a href=".*?">(.*?)<\\/a><\\/td><\\/tr>/si', $resp[data], $matches, PREG_PATTERN_ORDER); // 1 - Epnum, 2 - Air Date, 4 - Ep Name $epdata = array(); for ($x = 0; $x < count($matches[1]); $x++) { $epnums = explode("-", $matches[1][$x]); $epdata[$x]['season'] = trim($epnums[0]); $epdata[$x]['episode'] = trim($epnums[1]); $epdata[$x]['date'] = trim($matches[2][$x]); $epdata[$x]['title'] = trim($matches[3][$x]); } echo "Done. \n <br />"; echo "Retrieving Series Image... "; flush(); //Then we grab the shows image from the shows home page. $resp = httpClient($ephome, true); if (preg_match('/<img src="(\\/images\\/shows.+?)"/i', $resp['data'], $matches)) { $spic = "http://www.tvtome.com" . $matches[1]; echo "Done. \n <br /><hr />"; } flush(); //Finally, generate the form using this data. (Episode details are retrieved using tvtome.php by Andreas Gohr) $lastsea = $epdata[count($epdata) - 1]['season']; $lastep = $epdata[count($epdata) - 1]['episode']; ?> <form method="post" name="list" id="list"> <input type="hidden" name="seasons" value="<?php echo $lastsea; ?> " /> <input type="hidden" name="bodyurl" value="<?php echo $url; ?> guide.html" /> <input type="hidden" name="episodes" value="<?php echo $lastep; ?> " /> <center><table cellpadding="3" border="1" cellspacing="1" style="background-color:#dddddd; width:90%;"> <tr> <td colspan="3"><center>Series Picture:</center></td> <td colspan="2"><center><img src="<?php echo $spic; ?> " /><br /> <input type="text" name="s_pic" value="<?php echo $spic; ?> " style="width:100%;" /></center></td> </tr> <tr> <td colspan="3">Series Title: (i.e Stargate SG-1)</td> <td colspan="2"><input type="text" name="s_title" style="width:100%;" /></td> </tr> <tr> <td><a href="#" onClick="javascript:toggle()">Add To Collection</a></td> <td>Season</td> <td>Episode</td> <td>Title</td> <td>Air-Date</td> </tr> <?php $ids = array(); foreach ($epdata as $ep) { $id = 'c_' . trim($ep[season]) . 'x' . trim($ep[episode]); $ids[] = $id; ?> <tr> <td><input type="checkbox" name="<?php echo $id; ?> " id="<?php echo $id; ?> " /></td> <td><?php echo $ep['season']; ?> </td> <td><?php echo $ep['episode']; ?> </td> <td><?php echo $ep['title']; ?> <input type="hidden" value="<?php echo $ep['title']; ?> " name="t_<?php echo $ep[season] . 'x' . $ep[episode]; ?> " /></td> <td><?php echo $ep['date']; ?> <input type="hidden" value="<?php echo $ep['date']; ?> " name="d_<?php echo $ep[season] . 'x' . $ep[episode]; ?> " /></td> </tr> <?php } ?> <script language="javascript"> function toggle() { <?php foreach ($ids as $id) { echo "document.forms['list'].elements['{$id}'].checked = !document.forms['list'].elements['{$id}'].checked;\n"; } ?> return false; } </script> </table><br /> <input type="hidden" name="save" value="1"> <input type="submit" value="Add Selected Episodes" /></center> </form> <?php }
function fetchTomeSeasonInfos($url) { $response = httpClient($url, true); if (!$response['success']) { $CLIENTERROR .= $resp['error'] . "\n"; } // get show id if (preg_match('|/show/(\\d*)/episode_listings\\.html|', $url, $match)) { $showid = $match[1]; } //get the main body preg_match('|<div class="table-styled">(.*)</div>\\s*<div class="table-nav"|si', $response[data], $matches); $body = $matches[1]; //get episodes preg_match_all('|<td class="f-bold">[^<]*<a href="([^"]*summary\\.html[^"]*">[^<]*)</a>[^<]*</td>[^<]*<td class="ta-c"|si', $body, $matches); $ep = 1; $episodes = array(); //get infos; foreach ($matches[1] as $episode) { // Episode in season $episodes[$ep][number] = $ep; //title and url preg_match_all('/(http.*summary.html)[^"]*">(.*)/si', $episode, $fields); $episodes[$ep][subtitle] = $fields[2][0]; // URL code preg_match('|/episode/(\\d*)/|si', $fields[1][0], $match); $episodes[$ep][tvcomid] = 'tvcom:' . $showid . '-' . $match[1]; $ep++; } return $episodes; }
} } foreach ($films_to_update as $filmid) { if (!isset($updated_films[$filmid])) { $_RESULT["films_to_update"][] = $filmid; } } } else { $sql = "SELECT ID, CreateDate, imdbID FROM films WHERE ID={$film}"; $result = mysql_query($sql); if ($result && ($field = mysql_fetch_assoc($result))) { preg_match("/(\\d+)/i", $field["imdbID"], $matches); $imdbid = (int) $matches[1]; $createdate = date('Ymd', strtotime($field["CreateDate"])); $filmid = $field["ID"]; $response = httpClient($service_url . "?action=getimdbrating&l=" . md5($config['customer']['login']) . "&imdbid={$imdbid}&filmid={$filmid}&createdate={$createdate}", 0, '', 15, null, '', false, false); if (!preg_match("/^.*? 200 .*?\n/s", $response['header'])) { $_RESULT["errors"][] = 'Server returned wrong status.'; } else { $answer = preg_split("/(\r\n|\r|\n)/", $response['data']); if ((int) trim($answer[0])) { $imdbrating = (int) trim($answer[1]); $sql = "UPDATE films SET ImdbRating={$imdbrating}, UpdateDate=NOW() WHERE ID={$film}"; $result = mysql_query($sql); } else { for ($i = 1; $i < count($answer); $i++) { $_RESULT["errors"][] = trim($answer[$i]); } } } }
/** * Fetches the data for a given Dvdfr-ID * * @param int IMDB-ID * @return array Result data */ function dvdfrData($imdbID) { global $dvdfrServer; global $CLIENTERROR; $data = array(); // result $ary = array(); // temp $para['useragent'] = 'VideoDB (http://www.videodb.net/)'; // fetch mainpage $resp = httpClient(dvdfrContentUrl($imdbID), 1, $para); // added trailing / to avoid redirect if (!$resp['success']) { $CLIENTERROR .= $resp['error'] . "\n"; } // add encoding $data['encoding'] = get_response_encoding($resp); // See http://www.dvdfr.com/api/dvd.php?id=2869 for output // Titles preg_match('#<titres>\\s*<fr>(.+?)</fr>\\s*<vo>(.+?)</vo>#is', $resp['data'], $ary); $data['title'] = mb_convert_case(dvdfrCleanStr($ary[1]), MB_CASE_TITLE, $data['encoding']); $data['subtitle'] = mb_convert_case(dvdfrCleanStr($ary[2]), MB_CASE_TITLE, $data['encoding']); // I found: <div class="dvd_titleinfo">USA, Royaume-Uni , 2004<br />R&D TV, Sky TV, USA Cable Entertainment</div> preg_match('#<listePays>\\s*<pays.*?>(.+?)</pays>#is', $resp['data'], $ary); $data['country'] = dvdfrCleanStr($ary[1]); preg_match('#<annee>(\\d+)</annee>#is', $resp['data'], $ary); $data['year'] = dvdfrCleanStr($ary[1]); // Cover URL preg_match('#<cover>(.*?)</cover>#i', $resp['data'], $ary); $data['coverurl'] = trim($ary[1]); // Runtime preg_match('#<duree>(\\d+)</duree>#i', $resp['data'], $ary); $data['runtime'] = $ary[1]; // Director (only the first one) preg_match('#<star type="R.*?alisateur" id="\\d+">(.*?)</star>#i', $resp['data'], $ary); $data['director'] = dvdfrCleanStr($ary[1]); // Plot preg_match('#<synopsis>(.*?)</synopsis>#is', $resp['data'], $ary); if (!empty($ary[1])) { $data['plot'] = $ary[1]; // And cleanup $data['plot'] = preg_replace('/[\\n\\r]/', ' ', $data['plot']); $data['plot'] = preg_replace('/\\s+/', ' ', $data['plot']); $data['plot'] = dvdfrCleanStr($data['plot']); } // maps dvdfr category ids to videodb category names $category_map = array("1" => "Action", "2" => "Animation", "61" => "", "3" => "Adventure", "72" => "", "81" => "Musical", "4" => "Comedy", "5" => "Drama", "6" => "Musical", "74" => "Romance", "7" => "Music", "8" => "", "9" => "Short", "10" => "Documentary", "78" => "Documentary", "11" => "Music", "12" => "", "13" => "Documentary", "14" => "Drama", "73" => "Drama", "15" => "Adult", "16" => "Action", "17" => "Sci-Fi", "30" => "Musical", "83" => "Sport", "18" => "War", "19" => "Musical", "20" => "History", "21" => "Horror", "22" => "Comedy", "23" => "Animation", "24" => "Adult", "25" => "Music", "79" => "", "26" => "Music", "27" => "Action", "28" => "", "57" => "", "29" => "Documentary", "32" => "Music", "71" => "Music", "31" => "Music", "33" => "War", "34" => "Crime", "54" => "", "76" => "Music", "55" => "Music", "56" => "Sci-Fi", "60" => "", "75" => "", "58" => "", "59" => "", "62" => "", "63" => "Sport", "82" => "Sport", "64" => "Music", "65" => "", "66" => "Thriller", "67" => "Music", "68" => "Music", "69" => "Documentary", "70" => "Western", "Science Fiction" => "Sci-Fi"); // Genres (as Array) if (preg_match_all('#<categorie>(.*?)</categorie>#i', $resp['data'], $ary, PREG_PATTERN_ORDER) > 0) { $count = 0; while (isset($ary[1][$count])) { $data['genres'][] = $category_map[dvdfrCleanStr($ary[1][$count])]; $count++; } } // Cast if (preg_match('#<stars>(.*)</stars>#is', $resp['data'], $Section)) { preg_match_all('#<star type="Acteur" id="(\\d+)">(.*?)</star>#i', $Section[1], $ary, PREG_PATTERN_ORDER); for ($i = 0; $i < sizeof($ary[0]); $i++) { $cast .= dvdfrCleanStr($ary[2][$i]) . '::::dvdfr' . dvdfrCleanStr($ary[1][$i]) . "\n"; #$cast .= "$actor::$character::$imdbIdPrefix$actorid\n"; } $data['cast'] = dvdfrCleanStr($cast); } #// Convert ISO to UTF8 #$encoding = $data['encoding']; #foreach( $data as $k => $v ) { # $data[$k] = mb_convert_encoding(trim($v),'UTF-8',$encoding); #} return $data; }
if (empty($video['imdbID'])) { continue; } set_time_limit(300); // raise per movie execution timeout limit if safe_mode is not set in php.ini $id = $video['id']; $imdbID = $video['imdbID']; $engine = engineGetEngine($video['imdbID']); $fieldlist = ""; foreach (array_keys($_POST) as $param) { if (preg_match('/^(update_.*)/', $param, $fieldname)) { $fieldlist .= "&" . $fieldname[1] . "=1"; } } $url = $baseUrl . "/edit.php?id=" . $id . "&engine=" . $engine . "&save=1&lookup=" . $lookup . $fieldlist; $resp = httpClient($url, false, array('cookies' => $_COOKIE, 'no_proxy' => true, 'no_redirect' => true)); if (!$resp['success']) { $CLIENTERRORS[] = $video['title'] . " (" . $video['diskid'] . "/" . engineGetEngine($video['imdbID']) . "): " . $resp['error']; } else { $CLIENTOKS[] = $video['title'] . " (" . $video['diskid'] . "/" . engineGetEngine($video['imdbID']) . ")"; } } if (isset($resetDI) && $resetDI == "true") { // fix lent table after upper temp. changes $SELECT = "SELECT diskid FROM " . TBL_LENT . " WHERE diskid like 'TMP%'"; $lentResult = runSQL($SELECT); foreach ($lentResult as $lentRow) { $diskid = preg_replace('/^TMP/', '', $lentRow['diskid']); $UPDATE = "UPDATE " . TBL_LENT . " SET diskid = '" . $diskid . "' WHERE diskid = 'TMP" . $diskid . "'"; runSQL($UPDATE); }
/** * Parses Actor-Details * * Find image and detail URL for actor, not sure if this can be made * a one-step process? * * @author Andreas Goetz <*****@*****.**> * @param string $name Name of the Actor * @return array array with Actor-URL and Thumbnail */ function imdbActor($name, $actorid) { global $imdbServer; global $cache; // search directly by id or via name? $resp = httpClient(imdbActorUrl($name, $actorid), $cache); $ary = array(); // if not direct match load best match if (preg_match('#<b>Popular Names</b>.+?<a\\s+href="(.*?)">#i', $resp['data'], $m) || preg_match('#<b>Names \\(Exact Matches\\)</b>.+?<a\\s+href="(.*?)">#i', $resp['data'], $m) || preg_match('#<b>Names \\(Approx Matches\\)</b>.+?<a\\s+href="(.*?)">#i', $resp['data'], $m)) { if (!preg_match('/http/i', $m[1])) { $m[1] = $imdbServer . $m[1]; } $resp = httpClient($m[1], true); } // now we should have loaded the best match // only search in img_primary <td> - or we get far to many useless images preg_match('/<td.*?id="img_primary".*?>(.*?)<\\/td>/si', $resp['data'], $match); if (preg_match('/.*?<a.*?href="(.+?)"\\s*?>\\s*<img\\s+.*?src="(.*?)"/si', $match[1], $m)) { $ary[0][0] = $m[1]; $ary[0][1] = $m[2]; } return $ary; }
function searchPersonOzon($name, $first = true) { $ozonurl = "http://www.ozon.ru"; $response = httpClient($ozonurl . "/?context=search&type=person&text=" . urlencode($name), 0, '', 15, null, '', false, false); $res = array(); $contents = $response['data']; preg_match_all("/<big><a href=\"(.*?)\".*?class=\"bigger\">(.*?)<\\/a><\\/big>/is", $contents, $matches, PREG_SET_ORDER); foreach ($matches as $value) { if ($first) { return "http://www.ozon.ru" . $value[1]; } else { $res[] = array("http://www.ozon.ru" . $value[1], $value[2]); } } return $res; }
function ofdbscraperGetActorId($name) { global $ofdbscraperServer; // try to guess the id -> first actor found with this name $url = $ofdbscraperServer . '/view.php?page=liste&Name=' . urlencode(html_entity_decode_all($name)); $resp = httpClient($url, $cache); if (!$resp['success']) { $CLIENTERROR .= $resp['error'] . "\n"; } $resp['data'] = preg_replace('/[\\r\\n\\t]/', ' ', $resp['data']); return preg_match('#view.php?page=person&id=([0-9]+)#i', $resp['data'], $ary) ? $ary[1] : 0; }
/** * Search an image on isohunt * * Searches for a given title on the isohunt and returns the found links in * an array * * @param string The search string * @return array Associative array with id and title */ function isohuntSearch($title) { global $CLIENTERROR; global $isohuntServer; $data = array(); $url = $isohuntServer . '/js/rss/' . urlencode($title); $resp = httpClient($url, 1); if (!$resp['success']) { $CLIENTERROR .= $resp['error'] . "\n"; } // add encoding $data['encoding'] = get_response_encoding($resp); $xml = @simplexml_load_string($resp['data']); /* SimpleXMLElement Object ( [@attributes] => Array ( [version] => 2.0 ) [channel] => SimpleXMLElement Object ( [title] => isoHunt > All > scrubs [link] => http://isohunt.com [description] => BitTorrent search feeds > All > scrubs [language] => en-us [category] => All [ttl] => 60 [image] => SimpleXMLElement Object ( [title] => isoHunt > All > scrubs [url] => http://isohunt.com/img/buttons/isohunt-02.gif [link] => http://isohunt.com/ [width] => 157 [height] => 45 ) [lastBuildDate] => Sun, 22 Mar 2009 22:47:21 GMT [pubDate] => Sun, 22 Mar 2009 22:47:21 GMT [item] => Array ( [0] => SimpleXMLElement Object ( [title] => Scrubs. S08E12. HDTV. XviD [3/9] [link] => http://isohunt.com/torrent_details/72045453/scrubs?tab=summary [guid] => http://isohunt.com/torrent_details/72045453/scrubs?tab=summary [enclosure] => SimpleXMLElement Object ( [@attributes] => Array ( [url] => http://isohunt.com/download/72045453/scrubs.torrent [length] => 354292859 [type] => application/x-bittorrent ) ) [description] => <h3>Bit Torrent details:</h3>Category: TV<br>Original site: http://thepiratebay.org/<br>Size: 337.88 MB, in 2 files<br><br>Seeds: 3 | Leechers: 9 | Downloads: 16<p>Description:<br>Torrent downloaded from http://thepiratebay.org [pubDate] => Fri, 20 Mar 2009 22:55:22 GMT ) */ if (is_object($xml)) { foreach ($xml->channel->item as $row) { $res = array(); $res['title'] = (string) $row->title; # $res['imgsmall'] = $img; # $res['coverurl'] = $img; $res['url'] = (string) $row->link; $res['torrent'] = (string) $row->enclosure['url']; $res['filesize'] = (string) $row->enclosure['length']; $res['subtitle'] = sizetostring($res['filesize'], 1); $res['plot'] = (string) $row->description; if (preg_match('#(Seeds: .+?)<#', $res['plot'], $m)) { $res['sl'] = $m[1]; } # dump($res); $data[] = $res; } } # dump($data); return $data; }