projects
/
www-search-torrentz.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7dcf8cd
)
Parse numbers that contain commas correctly
author
Marius Gavrilescu
<marius@ieval.ro>
Sat, 19 Apr 2014 22:07:22 +0000
(
01:07
+0300)
committer
Marius Gavrilescu
<marius@ieval.ro>
Sat, 19 Apr 2014 22:07:22 +0000
(
01:07
+0300)
lib/WWW/Search/Torrentz.pm
patch
|
blob
|
blame
|
history
diff --git
a/lib/WWW/Search/Torrentz.pm
b/lib/WWW/Search/Torrentz.pm
index 34ae025bf83ae5ec030ca1f1f3df087de805720e..6e98c38538fe407f830d4861d7e107fcafe01e0a 100644
(file)
--- a/
lib/WWW/Search/Torrentz.pm
+++ b/
lib/WWW/Search/Torrentz.pm
@@
-23,6
+23,8
@@
sub _native_setup_search{
$self->user_agent->delay(2/60);
}
$self->user_agent->delay(2/60);
}
+sub fullint ($) { int (shift =~ y/0-9//cdr) }
+
sub _parse_tree{
my ($self, $tree) = @_;
my $found = 0;
sub _parse_tree{
my ($self, $tree) = @_;
my $found = 0;
@@
-31,8
+33,7
@@
sub _parse_tree{
my $result_count = $tree->find('h2')->as_text;
if (defined $result_count && $result_count ne 'No Torrents Found') {
$result_count =~ s/orrents.*//;
my $result_count = $tree->find('h2')->as_text;
if (defined $result_count && $result_count ne 'No Torrents Found') {
$result_count =~ s/orrents.*//;
- $result_count =~ y/0-9//cd;
- $self->approximate_result_count(int $result_count);
+ $self->approximate_result_count(fullint $result_count);
}
for my $node (@potential_results) {
}
for my $node (@potential_results) {
@@
-49,8
+50,8
@@
sub _parse_tree{
$verified = int ($span->as_text =~ m,^\d+,) when 'v';
$age = $span->as_text when 'a';
$size = $span->as_text when 's';
$verified = int ($span->as_text =~ m,^\d+,) when 'v';
$age = $span->as_text when 'a';
$size = $span->as_text when 's';
- $seeders = int $span->as_text when 'u';
- $leechers = int $span->as_text when 'd';
+ $seeders =
full
int $span->as_text when 'u';
+ $leechers =
full
int $span->as_text when 'd';
}
}
}
}
This page took
0.011472 seconds
and
4
git commands to generate.