Views: 271
Submissions: 0
Favs: 0
Registered: June 12, 2017 06:00:49 PM
use warnings;
use strict;
use 5.010;
#Created by WareZ, based on Karel's code.
use Fcntl qw(:flock SEEK_END);
my $tries_if_wrong=4;
#which is the first torrent to try.
my $first = 3211593 ;
sub ent {
my $w = shift;
$w =~ s/</</g;
$w =~ s/>/>/g;
return $w;
}
use 5.010;
sub try_once {
my $i = shift;
my $page="";
say "pred curl";
$page = `curl -s http://thepiratebay.org/torrent/$i -m 120`
while ($page !~ /<!DOCTYPE html/);
say "po curl";
my $line = "";
if ($page =~ m{<title>Not Found}) {
return undef;
} else {
my $richXML = "";
my $poorXML = "";
my ($uploaded) = $page =~ /<dt>Uploaded:<\/dt>\s*<dd>(.*?) GMT/s;
my ($title) = $page =~ /<div id="title">\s*(.*?)\s*<\/div>/s;
my ($size) = $page =~ /<dt>Size:<\/dt>\s*<dd>.*?\((\d*) Bytes\)<\/dd>/s;
my ($seeders) = $page =~ /<dt>Seeders:<\/dt>\s*<dd>(\d*)<\/dd>/;
my ($leechers) = $page =~ /<dt>Leechers:<\/dt>\s*<dd>(\d*)<\/dd>/;
my ($magnet) = $page =~ /magnet:\?xt=urn:btih:(.*?)(&|")/;
if (length($magnet)!=40) {
return undef;
}
$poorXML .= "<id>$i</id>\n<title>".ent($title)."</title>\n<magnet>$magnet</magnet>";
$richXML .= $poorXML;
$richXML.= "\n<size>$size</size>\n<seeders>$seeders</seeders>\n<leechers>$leechers</leechers>\n";
#this stopped working
#my ($up, $down) = $page =~ /<dd id="rating" class="">\s*\+(\d+) \/ -(\d+)/;
#$richXML.= "<quality><up>$up</up><down>$down</down></quality>\n";
$richXML.="<uploaded>$uploaded</uploaded>\n";
my ($nfo) = $page =~ /<div class="nfo">\s*<pre>(.*?)\s*<\/pre>/s;
$richXML.="<nfo>".ent($nfo)."</nfo>\n";
$richXML.="<comments>\n";
#really hacky stuff with pages
my ($compages) = $page =~ /<strong>(\d*)<\/strong>/;
if (!$compages) {$compages = 1}
for my $compagenu (1..$compages) {
my $comurl = 'http://thepiratebay.org/ajax_details_comments.php?id='.$i.'&page='.$compagenu.'&pages=2000';
my $comhtml = "";
#say "curl -s '$comurl' -m 120";
$comhtml = `curl -s '$comurl' -m 120`
while ($comhtml !~ /<div/);
while ($comhtml =~ /<div id="comment-\d*"><p class="byline">\s*<a href="\/user\/([^\/]*)\/".*?at (.*?) CET:\s*<\/p><div class="comment">\s*(.*?)\s*<\/div>/sg) {
my $time = $2;
my $com = $3;
$richXML .= "<comment><when>".ent($time)."</when><what>".ent($com)."</what></comment>\n";
}
}
$richXML.="</comments>\n";
return ($richXML, $poorXML);
}
}
say "start";
open my $outf_poor, ">>", "outf_poor.xml" or die $!;
open my $outf_rich, ">>", "outf_rich.xml" or die $!;
say "opened";
my $i = $first;
my $broke = 1;
while (1) {
$i++;
#$pm->start and next;
my $done = 0;
#will try each 3 times
my $tries = 0;
while (!$done){
my ($r, $p) = try_once($i);
if (defined $r) {
$broke=1;
say "$i success";
print $outf_poor "<torrent>\n$p\n</torrent>\n";
print $outf_rich "<torrent>\n$r\n</torrent>\n";
$done=1;
} else {
$tries++;
say "$i fail nu $tries";
if ($tries>($tries_if_wrong-1) or (!$broke)) {
$done=1;
}
}
}
}
=============================================================================================================
>Log Started_
Greetings everyone.
My name is WareZ.
Currently working on music and programming stuff, but recently got interested in drawing.
I am from Hungary, and I hope that one day, my drawing skills will improve.
Until then, please enjoy your stay!
Cheers!
use strict;
use 5.010;
#Created by WareZ, based on Karel's code.
use Fcntl qw(:flock SEEK_END);
my $tries_if_wrong=4;
#which is the first torrent to try.
my $first = 3211593 ;
sub ent {
my $w = shift;
$w =~ s/</</g;
$w =~ s/>/>/g;
return $w;
}
use 5.010;
sub try_once {
my $i = shift;
my $page="";
say "pred curl";
$page = `curl -s http://thepiratebay.org/torrent/$i -m 120`
while ($page !~ /<!DOCTYPE html/);
say "po curl";
my $line = "";
if ($page =~ m{<title>Not Found}) {
return undef;
} else {
my $richXML = "";
my $poorXML = "";
my ($uploaded) = $page =~ /<dt>Uploaded:<\/dt>\s*<dd>(.*?) GMT/s;
my ($title) = $page =~ /<div id="title">\s*(.*?)\s*<\/div>/s;
my ($size) = $page =~ /<dt>Size:<\/dt>\s*<dd>.*?\((\d*) Bytes\)<\/dd>/s;
my ($seeders) = $page =~ /<dt>Seeders:<\/dt>\s*<dd>(\d*)<\/dd>/;
my ($leechers) = $page =~ /<dt>Leechers:<\/dt>\s*<dd>(\d*)<\/dd>/;
my ($magnet) = $page =~ /magnet:\?xt=urn:btih:(.*?)(&|")/;
if (length($magnet)!=40) {
return undef;
}
$poorXML .= "<id>$i</id>\n<title>".ent($title)."</title>\n<magnet>$magnet</magnet>";
$richXML .= $poorXML;
$richXML.= "\n<size>$size</size>\n<seeders>$seeders</seeders>\n<leechers>$leechers</leechers>\n";
#this stopped working
#my ($up, $down) = $page =~ /<dd id="rating" class="">\s*\+(\d+) \/ -(\d+)/;
#$richXML.= "<quality><up>$up</up><down>$down</down></quality>\n";
$richXML.="<uploaded>$uploaded</uploaded>\n";
my ($nfo) = $page =~ /<div class="nfo">\s*<pre>(.*?)\s*<\/pre>/s;
$richXML.="<nfo>".ent($nfo)."</nfo>\n";
$richXML.="<comments>\n";
#really hacky stuff with pages
my ($compages) = $page =~ /<strong>(\d*)<\/strong>/;
if (!$compages) {$compages = 1}
for my $compagenu (1..$compages) {
my $comurl = 'http://thepiratebay.org/ajax_details_comments.php?id='.$i.'&page='.$compagenu.'&pages=2000';
my $comhtml = "";
#say "curl -s '$comurl' -m 120";
$comhtml = `curl -s '$comurl' -m 120`
while ($comhtml !~ /<div/);
while ($comhtml =~ /<div id="comment-\d*"><p class="byline">\s*<a href="\/user\/([^\/]*)\/".*?at (.*?) CET:\s*<\/p><div class="comment">\s*(.*?)\s*<\/div>/sg) {
my $time = $2;
my $com = $3;
$richXML .= "<comment><when>".ent($time)."</when><what>".ent($com)."</what></comment>\n";
}
}
$richXML.="</comments>\n";
return ($richXML, $poorXML);
}
}
say "start";
open my $outf_poor, ">>", "outf_poor.xml" or die $!;
open my $outf_rich, ">>", "outf_rich.xml" or die $!;
say "opened";
my $i = $first;
my $broke = 1;
while (1) {
$i++;
#$pm->start and next;
my $done = 0;
#will try each 3 times
my $tries = 0;
while (!$done){
my ($r, $p) = try_once($i);
if (defined $r) {
$broke=1;
say "$i success";
print $outf_poor "<torrent>\n$p\n</torrent>\n";
print $outf_rich "<torrent>\n$r\n</torrent>\n";
$done=1;
} else {
$tries++;
say "$i fail nu $tries";
if ($tries>($tries_if_wrong-1) or (!$broke)) {
$done=1;
}
}
}
}
=============================================================================================================
>Log Started_
Greetings everyone.
My name is WareZ.
Currently working on music and programming stuff, but recently got interested in drawing.
I am from Hungary, and I hope that one day, my drawing skills will improve.
Until then, please enjoy your stay!
Cheers!
Gallery
This user has no submissions.
Favorites
This user has no favorites.
Recent Watchers
Recently Watched
Stats
Comments Earned: 1
Comments Made: 4
Journals: 1
Comments Made: 4
Journals: 1
Recent Journal
Beginning (G)
8 years ago
Whew!
New day, new start I guess!
Hello world, here I come!
So, how should I start?
I have no clue!
This will be fun!
New day, new start I guess!
Hello world, here I come!
So, how should I start?
I have no clue!
This will be fun!
User Profile
Accepting Trades
No Accepting Commissions
No Character Species
Panther
Favorite Music
Classic
Favorite TV Shows & Movies
World War Z
Favorite Games
Hacknet, Uplink
Favorite Gaming Platforms
PC
Favorite Animals
Cats
Favorite Site
www.slavehack2.com, hacktheplanet.com
Favorite Foods & Drinks
Don't be upsetti, eat some spaghetti
Favorite Quote
Life is like riding a bicycle. To keep your balance, you must keep moving. (A.E.)
Favorite Artists
Zeta-Haru
FA+