-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_torrents.php
executable file
·69 lines (56 loc) · 1.98 KB
/
search_torrents.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
require('config.php');
if(empty($_REQUEST['folder'])){
$_REQUEST['folder'] = $conf['directory'] . 'music';
$s_str = '/0/99/101';
}
switch($_REQUEST['folder']){
case('music'):
$s_str = '/0/99/101';
break;
case('games'):
$s_str = '/0/99/400';
$mv_folder = explode(" - ", $_REQUEST['q']);
if(!empty($mv_folder)){
$new_folder = $mv_folder[1];
}
break;
case('videos'):
if($_REQUEST['q'] == 'new'){
$URL = 'https://thepiratebay.rocks/top/201';
}else{
$s_str = '/0/99/200';
}
break;
}
if(empty($URL)){
$URL = @'https://thepiratebay.rocks/search/' . @$_REQUEST['q'] . @$s_str;
}
$ch = curl_init();
if(!empty($_REQUEST['url'])){
$URL = $_REQUEST['url'];
}
echo $URL;
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
curl_setopt($ch, CURLOPT_COOKIE, "language=us_EN; c[thepiratebay.se][/][language]=us_EN");
$pirate = curl_exec ($ch);
$pirate = explode('<table id="searchResult">' , $pirate);
$pirate = @explode('</table>', $pirate[1]);
//print_r($pirate);
if(empty($new_folder)){
$pirate = str_replace("<a href=\"magnet", '<a alt="' . $conf['directory'] . $_REQUEST['folder'] . '" class="torrent_link" href="javascript:;" data-link="magnet', $pirate[0]);
}else{
$pirate = str_replace("<a href=\"magnet", '<a alt="' . $conf['directory'] . $_REQUEST['folder'] . $mv_folder . '" class="torrent_link" href="javascript:;" data-link="magnet', $pirate[0]);
}
$pirate = str_replace("Type", "", $pirate);
$pirate = str_replace('<center>', '<br class="clear" />', $pirate);
$pirate = str_replace('(', '', $pirate);
$pirate = str_replace(')', '', $pirate);
$pirate = str_replace(', ULed by', '', $pirate);
echo '<div id="torrent_listings">' . $pirate . '</div>';
curl_close($ch);
?>