<?php require_once 'includes/config.php'; require_once 'includes/rivr.php'; require_once 'includes/functions.php'; $q = clean_text(mb_strtolower(htmlspecialchars(urldecode($_GET['q'])))); $date = time(); $query = $db->query("SELECT query, type FROM queries WHERE query LIKE '{$q}%' ORDER BY count+count/POW(2,({$date}-first_date)/21600) DESC;"); while ($data = $query->fetch_assoc()) { $suggestions[] = array('query' => $data['query'], 'type' => mb_strtoupper(Rivr::getTypeInt($data['type']))); } echo json_encode($suggestions);
private function index($data, $db, $sdb) { $data = str_get_html($data); if (!$data->find('#searchResult')) { return; } $data = $data->find('#searchResult', 0); foreach ($data->find('tr') as $result) { if (!$result->find('.detLink')) { continue; } $title = $result->find('.detLink', 0)->plaintext; $url = explode('/', 'https://thepiratebay.se' . $result->find('.detLink', 0)->href); array_pop($url); $url = implode('/', $url); $magnet = $result->find('td', 1); $magnet = $magnet->find('a', 1)->href; $hash = strtoupper(between($magnet, 'magnet:?xt=urn:btih:', '&dn=')); $size = str_replace(' ', ' ', $result->find('.detDesc', 0)->plaintext); $words = mb_split('iB', $size); $words2 = mb_split('\\s', $words[0]); $length = count($words2); $size = $words2[$length - 2] . ' ' . $words2[$length - 1] . 'B'; $size = round(strToBytes($size) / 1024); $seeds = $result->find('td', 2)->plaintext; $peers = $result->find('td', 3)->plaintext; $date = str_replace(' ', ' ', $result->find('.detDesc', 0)->plaintext); $date = str_replace('-', '/', between($date, 'Uploaded ', ', Size')); $date = strtotime($date); $uploader = $result->find('a.detDesc'); if ($uploader) { $uploader = $uploader[0]->plaintext; } $cdata = $result->find('a', 1)->href; $cdata2 = $result->find('a', 0)->href; if (strstr($cdata, 'browse/201') || strstr($cdata, 'browse/207')) { $type = 'movies'; } elseif (strstr($cdata2, 'browse/400')) { $type = 'games'; } elseif (strstr($cdata, 'browse/101')) { $type = 'music'; } elseif (strstr($cdata2, 'browse/300')) { $type = 'software'; } elseif (strstr($cdata, 'browse/205') || strstr($cdata, 'browse/208')) { $type = 'tv'; } elseif (strstr($cdata2, 'browse/500')) { $type = 'p**n'; } else { $type = 'other'; } $type = Rivr::getType($type); $cdate = time(); $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;"); if ($query->num_rows) { $this->updated++; $info = $query->fetch_assoc(); Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } else { $this->added++; Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } } $data->clear(); unset($data); }
private function index($data, $db, $sdb) { $data = str_get_html($data); foreach ($data->find('.even, .odd') as $result) { $title = $result->find('.cellMainLink', 0)->plaintext; $url = 'https://kat.cr' . $result->find('.cellMainLink', 0)->href; $m = $result->find('div.iaconbox', 0); $hash = strtoupper(between($m, 'magnet:?xt=urn:btih:', '&dn=')); $size = round(strToBytes($result->find('td.nobr', 0)->plaintext) / 1024); $seeds = $result->find('td.green', 0)->plaintext; $peers = $result->find('td.red', 0)->plaintext; $date = strtotime($result->find('td', 3)->title); $uploader = $result->find('a.plain', 1)->plaintext; $files = $result->find('td', 2)->plaintext; if (!$result->find('span.block')) { continue; } $cdata = $result->find('span.block', 0)->find('strong', 0)->plaintext; if (strstr($cdata, 'Movies')) { $type = 'movies'; } elseif (strstr($cdata, 'Games')) { $type = 'games'; } elseif (strstr($cdata, 'Music')) { $type = 'music'; } elseif (strstr($cdata, 'Applications')) { $type = 'software'; } elseif (strstr($cdata, 'TV')) { $type = 'tv'; } elseif (strstr($cdata, 'XXX')) { $type = 'p**n'; } elseif (strstr($cdata, 'Anime')) { $type = 'anime'; } elseif (strstr($cdata, 'Books')) { $type = 'books'; } else { $type = 'other'; } $type = Rivr::getType($type); $cdate = time(); $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;"); if ($query->num_rows) { $this->updated++; $info = $query->fetch_assoc(); Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } else { $this->added++; Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } } $data->clear(); unset($data); }
private function index($data, $db, $sdb) { $data = str_get_html($data); if (!$data->find('.table-torrents')) { return; } $data = $data->find('.table-torrents', 0); foreach ($data->find('tr') as $result) { if (!$result->find('td.title-row')) { continue; } $title = $result->find('td.title-row', 0)->find('a', 0)->plaintext; $url = 'https://isohunt.to' . $result->find('td.title-row', 0)->find('a', 0)->href; $size = round(strToBytes($result->find('td.size-row', 0)->plaintext) / 1024); $seeds = $result->find('td.sy', 0)->plaintext; $peers = 0; $hash = ''; $date = strtotime($result->find('td.date-row', 0)->plaintext); $cdata = strtolower($result->find('span.torrent-icon', 0)->title); if (strstr($cdata, 'movies')) { $type = 'movies'; } elseif (strstr($cdata, 'games')) { $type = 'games'; } elseif (strstr($cdata, 'music')) { $type = 'music'; } elseif (strstr($cdata, 'software')) { $type = 'software'; } elseif (strstr($cdata, 'tv')) { $type = 'tv'; } elseif (strstr($cdata, 'adult')) { $type = 'p**n'; } elseif (strstr($cdata, 'anime')) { $type = 'anime'; } elseif (strstr($cdata, 'books')) { $type = 'books'; } else { $type = 'other'; } $type = Rivr::getType($type); $cdate = time(); $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;"); if ($query->num_rows) { $this->updated++; $info = $query->fetch_assoc(); Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } else { $this->added++; Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } } $data->clear(); unset($data); }
private function index($data, $type, $db, $sdb) { $data = str_get_html($data); if (!$data->find('.table2')) { return; } $data = $data->find('.table2', 0); if (!$data->find('tr')) { continue; } foreach ($data->find('tr') as $result) { $tt = $result->find('.tt-name'); if (!$tt) { continue; } $title = $result->find('.tt-name', 0)->find('a', 1)->plaintext; $url = 'https://www.limetorrents.cc' . $result->find('.tt-name', 0)->find('a', 1)->href; $m = $result->find('.tt-name', 0)->find('a', 0)->href; $hash = strtoupper(between($m, 'torrent/', '.torrent')); $size = round(strToBytes($result->find('td', 2)->plaintext) / 1024); $seeds = $result->find('.tdseed', 0)->plaintext; $peers = $result->find('.tdleech', 0)->plaintext; $date = strtotime('-' . str_replace(' ago', '', $result->find('td', 1)->plaintext)); $uploader = ''; $files = 0; $cdate = time(); $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;"); if ($query->num_rows) { $this->updated++; $info = $query->fetch_assoc(); Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } else { $this->added++; Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } } $data->clear(); unset($data); }
<?php require_once 'includes/config.php'; require_once 'includes/rivr.php'; require_once 'includes/functions.php'; $type = $_GET['type']; $q = urldecode($_GET['q']); if ($q && ($type == 0 || $type == 1)) { $imdb_id = Rivr::findImdbId($q); if ($imdb_id > 0) { $imdb_id = 'tt' . str_pad($imdb_id, 7, '0', STR_PAD_LEFT); $mdata = json_decode(gethtml("http://www.omdbapi.com/?i={$imdb_id}&plot=short&r=json"), true); $poster = "cache/imdb_posters/{$imdb_id}.jpg"; if (!file_exists($poster)) { $ch = curl_init($mdata['Poster']); $fp = fopen($poster, 'wb'); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); } echo "<a class=\"image\" href=\"{$poster}\"><img src=\"{$poster}\" class=\"poster\"></a><span class=\"title\">{$mdata['Title']} ({$mdata['Year']}) · {$mdata['Type']}</span><br/><br/><a class=\"ptag\" href=\"http://www.imdb.com/title/{$imdb_id}/\" target=\"blank\">IMDB link</a><a class=\"ptag\" href=\"#\" id=\"trailer\">Watch trailer</a><br/><br/><b>IMDB rating:</b> {$mdata['imdbRating']} ({$mdata['imdbVotes']} votes)<br/>{$mdata['Rated']} · {$mdata['Runtime']} · {$mdata['Genre']} · {$mdata['Released']}<br/><br/><div id='plot'><b>Plot:</b> {$mdata['Plot']}</div><br/><b>Actors:</b> {$mdata['Actors']}"; ?> <script> $(document).ready(function(){ var yt_url='https://content.googleapis.com/youtube/v3/search?part=snippet&type=video&videoEmbeddable=true&lr=en&orderby=viewCount&maxResults=1&hl=en&key=AIzaSyB0Jm1M4z4ffP3yFdEPFk-sd9XU5JabZLM&q=<?php echo urlencode(urldecode($mdata['Title'])); ?> +official+trailer';
} $magnet = "magnet:?xt=urn:btih:{$hash}&dn=" . urlencode($title) . '&tr=' . implode('&tr=', $trackers); } echo "<a href=\"{$magnet}\" class=\"ptag\">Magnet</a>"; ?> </p> <?php echo "<table class=\"rtable\">"; echo "<tr><td class=\"top_row\" width=\"800px\">{$title} ~ {$count} sources</td></tr>"; foreach ($cdata as $data) { echo "<tr class=\"row\"><td><img src=\"https://plus.google.com/_/favicon?domain={$sources[$data['source_id']]}\" class=\"icon\"> " . $sources[$data['source_id']]; if ($data['url']) { echo " · <a href=\"{$data['url']}\" target=\"blank\">{$data['title']}</a>"; } echo " · " . Rivr::getTypeInt($data['category']) . "</td></tr>"; } echo "</table><br/>"; if ($torrent) { echo "<table class=\"table\"><tr><td width=\"405px\" align=\"left\" valign=\"top\">"; //trackers info echo "<td width=\"405px\" align=\"right\" valign=\"top\"><table class=\"rtable_sm\">"; echo "<tr><td class=\"top_row\" width=\"390px\">Trackers</td></tr>"; foreach ($trackers as $tracker) { echo "<tr class=\"row small\"><td>{$tracker}</td></tr>"; } echo "</table></td></tr></table><br/>"; //torrent contents function &getArrayPath($path, &$array) { $path = explode('/', $path);
$rtype = ''; } echo "<tr class=\"row\"><td style=\"width:700px;\">{$rtype}<a href=\"{$data['hash']}\">{$data['title']}</a></td><td width=\"70px\" class=\"seeds\">{$data['seeds']}</td><td width=\"70px\" class=\"leech\">{$data['peers']}</td><td width=\"90px\">" . bytesToStr($data['size'] * 1024) . "</td></tr>"; } echo "</table><br/>"; $categories = array(0 => 'Movies', 1 => 'TV', 3 => 'Games', 2 => 'Software', 4 => 'Music', 6 => 'Anime', 7 => 'Books', 5 => 'P**n'); foreach ($categories as $key => $val) { echo "<table class=\"rtable\">"; echo "<tr class=\"top_row\"><td colspan=\"4\">{$val}</td></tr>"; $query = $sdb->query("SELECT *, (seeds+0.2*peers) AS score FROM rtindex0,rtindex1,rtindex2,rtindex3 WHERE category = {$key} ORDER BY score DESC LIMIT 7"); while ($data = $query->fetch_assoc()) { $iquery = $db->query("SELECT title FROM rtindex WHERE id = '{$data['id']}';"); $idata = $iquery->fetch_assoc(); $data['title'] = $idata['title']; if ($data['category'] != 8) { $rtype = "<img src=\"images/" . Rivr::getTypeInt($data['category']) . ".png\" class=\"icon\"/>"; } else { $rtype = ''; } echo "<tr class=\"row\"><td style=\"width:700px;\">{$rtype}<a href=\"{$data['hash']}\">{$data['title']}</a></td><td width=\"70px\" class=\"seeds\">{$data['seeds']}</td><td width=\"70px\" class=\"leech\">{$data['peers']}</td><td width=\"90px\">" . bytesToStr($data['size'] * 1024) . "</td></tr>"; } echo "</table><br/>"; } ?> </div> <?php include "includes/footer.php"; ?>
public static function updateTorrent($db, $sdb, $id, $title, $hash, $source_id, $seeds, $peers, $date, $url, $indexed, $category, $size, $files, $uploader) { $parent = Rivr::isParent($sdb, $id, $hash, $seeds, $peers); $bin = $id % 4; $title = mysql_real_escape_string($title); $uploader = mysql_real_escape_string($uploader); $seeds = str_replace('.', '', $seeds); $peers = str_replace(',', '', $peers); $seeds = intval($seeds); $peers = intval($peers); $date = intval($date); if ($parent) { $q = $db->query("UPDATE rtindex SET parent = 0 WHERE hash = '{$hash}'"); if (!$q) { die("UPDATE rtindex SET parent = 0 WHERE hash = '{$hash}'"); } $q = $sdb->query("DELETE FROM rtindex" . $bin . " WHERE hash = '{$hash}' AND id != {$id}"); if (!$q) { die("DELETE FROM rtindex" . $bin . " WHERE hash = '{$hash}' AND id != {$id}"); } } $q = $db->query("UPDATE rtindex SET title = '{$title}', hash = '{$hash}', source_id = '{$source_id}', seeds = '{$seeds}', peers = '{$peers}', date = '{$date}', url = '{$url}', indexed = '{$indexed}', category = '{$category}', size = '{$size}', files = '{$files}', uploader = '{$uploader}' WHERE id = '{$id}';"); if (!$q) { die("UPDATE rtindex SET title = '{$title}', hash = '{$hash}', source_id = '{$source_id}', seeds = '{$seeds}', peers = '{$peers}', date = '{$date}', url = '{$url}', indexed = '{$indexed}', category = '{$category}', size = '{$size}', files = '{$files}', uploader = '{$uploader}' WHERE id = '{$id}';"); } $q = $sdb->query("REPLACE INTO rtindex" . $bin . " VALUES({$id}, '{$title}', '{$hash}', {$source_id}, {$seeds}, {$peers}, {$date}, {$category}, {$size})"); if (!$q) { die("REPLACE INTO rtindex" . $bin . " VALUES({$id}, '{$title}', '{$hash}', {$source_id}, {$seeds}, {$peers}, {$date}, {$category}, {$size})"); } }
private function index($data, $db, $sdb) { $data = str_get_html($data); if (!$data->find('div.tab-detail')) { return; } $data = $data->find('div.tab-detail', 0); foreach ($data->find('li') as $result) { if (!$result->find('a')) { continue; } $title = $result->find('a', 1)->plaintext; $url = 'https://1337x.to' . $result->find('a', 1)->href; $size = round(strToBytes($result->find('div.coll-4', 0)->plaintext) / 1024); $seeds = $result->find('span.green', 0)->plaintext; $peers = $result->find('span.red', 0)->plaintext; $hash = ''; $uploader = $result->find('.uploader, .vip', 0)->plaintext; $cdata = $result->find('.coll-1', 0)->find('i', 0)->class; if (strstr($cdata, 'Movies')) { $type = 'movies'; } elseif (strstr($cdata, 'Games')) { $type = 'games'; } elseif (strstr($cdata, 'Music')) { $type = 'music'; } elseif (strstr($cdata, 'Apps')) { $type = 'software'; } elseif (strstr($cdata, 'TV')) { $type = 'tv'; } elseif (strstr($cdata, 'XXX')) { $type = 'p**n'; } elseif (strstr($cdata, 'Anime')) { $type = 'anime'; } else { $type = 'other'; } $type = Rivr::getType($type); $cdate = time(); $query = $db->query("SELECT id FROM rtindex WHERE url = '{$url}' LIMIT 1;"); if ($query->num_rows) { $this->updated++; $info = $query->fetch_assoc(); Rivr::updateTorrent($db, $sdb, $info['id'], $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } else { $this->added++; Rivr::addTorrent($db, $sdb, $title, $hash, $this->source_id, $seeds, $peers, $date, $url, $cdate, $type, $size, $files, $uploader); } } $data->clear(); unset($data); }