Changeset 1420
- Timestamp:
- 07/02/12 16:46:33 (11 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
grabbers/news (modified) (4 diffs)
-
status (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/grabbers/news
r1405 r1420 4 4 # 5 5 6 my $version = ' 2.0';6 my $version = '3.0'; 7 7 8 8 use strict; … … 30 30 31 31 my $DATASOURCE = "http://guides.news.com.au"; 32 my $DATASOURCE_SETUP = "$DATASOURCE/television/profile/?action=saveProfile"; 32 my $DATASOURCE_SETUP = "$DATASOURCE/television/profile/"; 33 my $DATASOURCE_CHANNEL_LIST= "$DATASOURCE/television/profile/ajax.cfm?"; 33 34 my $DATASOURCE_GUIDE = "$DATASOURCE/television/guide/"; 34 35 my $DATASOURCE_GUIDE_TODAY = "$DATASOURCE/television/guide/?action=restofday"; … … 94 95 } 95 96 96 if ($debug or $opt->{'show-config'}) 97 { 98 show_config(); 99 exit 0 if ($opt->{'show-config'}); 100 } 97 show_config(); 98 exit 0 if ($opt->{'show-config'}); 101 99 102 100 restore_cache(); … … 382 380 $ua = Shepherd::Common::setup_ua( cookie_jar => 1 ); 383 381 382 # Get list of 'venue IDs', which are the source's 383 # internal channel ID numbers. 384 385 print "Looking for venue IDs...\n" if ($debug); 386 387 my $html = &get_page(url => $DATASOURCE_CHANNEL_LIST, retries => 4, postvars => [ 'action' => 'channels', 'region_id' => $opt->{'region'}, 'showsub' => '0' ]); 388 unless ($html) 389 { 390 print "Unable to fetch channel list. Exiting.\n"; 391 die "Unable to fetch channel list (no network?)"; 392 } 393 394 my @venue_ids; 395 my $tree = HTML::TreeBuilder->new_from_content($html); 396 my %clist = %$channels; 397 foreach my $tag ($tree->look_down('_tag' => 'label')) 398 { 399 my $channel_name = &strip_whitespace($tag->as_text); 400 if ($channels->{$channel_name}) 401 { 402 # We want this channel 403 $tag->as_HTML =~ /venue_id__(\d+)/; 404 push @venue_ids, $1; 405 406 delete $clist{$channel_name}; 407 } 408 } 409 410 unless (@venue_ids) 411 { 412 print "No wanted channels found? Exiting.\n"; 413 die "No wanted channels found."; 414 } 415 416 if (keys %clist) 417 { 418 print "\n!!! WARNING! Could not find venue IDs for channels: " . join(', ', keys %clist) . ".\n\n"; 419 } 420 421 print "Venue IDs: " . join(',', @venue_ids) . "\n" if ($debug); 422 384 423 # Set region/service cookie 385 unless (get_page(url => $DATASOURCE_SETUP, retries => 4, postvars => [ 'fta_region_id' => $opt->{'region'} ])) 424 my $postvars = [ 'action' => 'saveProfile', 'fta_region_id' => $opt->{'region'} ]; 425 foreach (@venue_ids) 426 { 427 push @$postvars, 'venue_id', $_; 428 } 429 430 unless (&get_page(url => $DATASOURCE_SETUP, retries => 4, postvars => $postvars )) 386 431 { 387 432 print "Unable to fetch profile page. No network? Exiting.\n"; -
trunk/status
r1419 r1420 5 5 reference Shepherd/Configure.pm 0.30 6 6 reference Shepherd/json_pp.pm 0.2 7 grabber news 2.07 grabber news 3.0 8 8 grabber oztivo 2.50 9 9 grabber yahoo7widget 2.28
