Changeset 602
- Timestamp:
- 03/06/07 18:18:26 (6 years ago)
- Files:
-
- 2 modified
-
grabbers/rex (modified) (7 diffs)
-
status (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
grabbers/rex
r584 r602 3 3 # "Rex" 4 4 5 my $version = '3. 5.0';5 my $version = '3.4.6'; 6 6 7 7 # An Australian TV Guide Grabber (a.k.a. tv_grab_au) … … 77 77 # 3.4.4 : Bugfix : --dump-cache works 78 78 # 3.4.5 : Bugfix : support regions with multiple channels of same name 79 # 3.4.6 : Bugfix : more reliable dying on network failure 79 80 80 81 use strict; … … 443 444 444 445 # Set initial cookie 445 get_page($DATASOURCE); 446 unless (get_page($DATASOURCE, 5)) # Try hard to fetch main page 447 { 448 print "Unable to fetch main datasource page. No connectivity? Exiting.\n"; 449 print stats(1); 450 die "Can't fetch main page."; 451 } 446 452 447 453 # Set region/service cookie 448 post_page($DATASOURCE_SETUP, 449 [ 'fta_region_id' => $opt->{'region'} ]); 454 unless (post_page($DATASOURCE_SETUP, [ 'fta_region_id' => $opt->{'region'} ])) 455 { 456 print "ERROR: Unable to set region/service cookie.\n"; 457 print stats(1); 458 die "Can't set region/service cookie."; 459 } 450 460 451 461 $ua->cookie_jar()->scan(\&refresh_sid); … … 577 587 sub get_page 578 588 { 579 my ($url ) = @_;589 my ($url, $retries) = @_; 580 590 my $request = GET $url; 581 return fetch_page($request );591 return fetch_page($request, $retries); 582 592 } 583 593 … … 591 601 sub fetch_page 592 602 { 593 my ($request ) = @_;603 my ($request, $retries) = @_; 594 604 595 605 $request->uri() =~ s/^http:\/\//$WW/ if $opt->{warper}; … … 598 608 599 609 print "Fetching: " . $request->as_string() . "\n" if ($debug); 610 $retries ||= 2; 600 611 my $response; 601 for my $c (1.. 2) {612 for my $c (1..$retries) { 602 613 print "Attempt #$c.\n" if ($debug); 603 614 $response = $ua->request($request); … … 615 626 while ($r) { print " ", $r->base, "\n"; $r = $r->previous } 616 627 } 617 # Network down 618 if ($count_bad > 10 and $count_dl == 0) 619 { 620 print "ERROR! Unable to download anything useful. Smells like a " . 621 "network problem. Exiting.\n"; 628 if ($count_dl and ($count_bad > ($count_dl * 3))) 629 { 630 print "Too many network failures. Exiting.\n"; 622 631 print stats(1); 623 die " No connectivity";632 die "Too many network failures."; 624 633 } 625 634 return undef; -
status
r601 r602 1 1 application shepherd 0.4.76 2 2 grabber yahoo7widget 1.81 3 grabber rex 3.4. 53 grabber rex 3.4.6 4 4 grabber abc_website 2.11 5 5 grabber abc2_website 2.11
