line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: NewsGroup.pm,v 1.9 2003/09/22 03:14:55 cvspub Exp $ |
2
|
|
|
|
|
|
|
package WWW::Google::Groups::NewsGroup; |
3
|
1
|
|
|
1
|
|
9
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
491
|
use WWW::Google::Groups::Thread; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
6
|
1
|
|
|
1
|
|
12
|
use WWW::Google::Groups::Vars; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
159
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
7
|
use Storable qw(dclone); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
118
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
0
|
|
my ($pkg, $arg, $group) = @_; |
11
|
0
|
|
|
|
|
|
my $hash = dclone $arg; |
12
|
0
|
|
|
|
|
|
$hash->{_group} = $group; |
13
|
0
|
|
|
|
|
|
$hash->{_thread_no} = 0; |
14
|
0
|
|
|
|
|
|
bless $hash, $pkg; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub starting_thread($;$) { |
18
|
0
|
0
|
|
0
|
0
|
|
$_[0]->{_thread_no} = $_[1] if $_[1]; |
19
|
0
|
|
|
|
|
|
$_[0]->{_thread_no}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
4
|
use WWW::Mechanize; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
371
|
|
23
|
|
|
|
|
|
|
sub next_thread { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if(defined $self->{_max_thread_count}){ |
27
|
0
|
0
|
|
|
|
|
return if $self->{_thread_no} >= $self->{_max_thread_count}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
0
|
|
|
|
if(!ref ($self->{_threads}) or !scalar @{$self->{_threads}}){ |
|
0
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my @threads; |
32
|
0
|
|
|
|
|
|
$self->{_agent}->agent_alias( $agent_alias[int rand(scalar @agent_alias)] ); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$self->{_agent}->get($self->{_server}."/groups?dq=&num=25&hl=en&lr=&ie=UTF-8&group=".$self->{_group}."&safe=off&start=".$self->{_thread_no}); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# print $self->{_agent}->uri(),$/; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $content = $self->{_agent}->content; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
foreach my $link ( |
|
0
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
grep {$_->[0]=~/(?:threadm|selm)=/o} |
42
|
0
|
|
|
|
|
|
grep {$_->[0]=~m,/(?:url|groups)\?d?q=,o} |
43
|
|
|
|
|
|
|
map {[$_->url, $_->text]} $self->{_agent}->links |
44
|
|
|
|
|
|
|
){ |
45
|
|
|
|
|
|
|
# print ">>".$link->[0].$/; |
46
|
0
|
|
|
|
|
|
push @threads, { _url => $link->[0], _title => $link->[1] }; |
47
|
|
|
|
|
|
|
} |
48
|
0
|
0
|
|
|
|
|
return unless @threads; |
49
|
|
|
|
|
|
|
# print Dumper \@threads; |
50
|
0
|
|
|
|
|
|
$self->{_threads} = \@threads; |
51
|
|
|
|
|
|
|
} |
52
|
0
|
0
|
|
|
|
|
$self->{_thread_no}++ if @{$self->{_threads}}; |
|
0
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
new WWW::Google::Groups::Thread($self, shift @{$self->{_threads}}); |
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
__END__ |