xmltv/grab/uk_guardian tv_grab_uk_guardian,1.4,1.5
Geoff <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/uk_guardian
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv26145
Modified Files:
tv_grab_uk_guardian
Log Message:
Workaround for fault in The Guardian's website
Index: tv_grab_uk_guardian
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/uk_guardian/tv_grab_uk_guardian,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** tv_grab_uk_guardian 20 Oct 2013 17:13:35 -0000 1.4
--- tv_grab_uk_guardian 6 Dec 2013 13:42:41 -0000 1.5
***************
*** 201,210 ****
# Scrub the page
if ($tree) {
- my $channelname = $tree->look_down('_tag' => 'div', 'class' => 'tvg_channelname'); # e.g. "5 Star - channel number 176"
- my $channelnum = $channelname->look_down('_tag' => 'span', 'class' => 'tvg_channelnumber'); # e.g. " - channel number 176"
- my $schedule = $channelname->parent;
- $channelname = $channelname->as_text;
! my @shows = $schedule->look_down('_tag' => 'span', 'class' => 'tvg_show');
if (@shows) {
foreach my $show (@shows) {
--- 201,250 ----
# Scrub the page
if ($tree) {
! # 6-Dec-2013 : we must find a workaround for a bug in The Guardian's website. When asking for a regionalised channel (e.g. BBC2)
! # their website is displaying not only "BBC 2" but also "BBC 2 Northern Ireland (Digital)" & "BBC 2 Scotland (Digital)"
! # concatenated one after each other with no break. Been broken for nearly 2 weeks now.
! # I've reported it to their web team but no response.
! #
! # my $channelname = $tree->look_down('_tag' => 'div', 'class' => 'tvg_channelname'); # e.g. "5 Star - channel number 176"
! # my $channelnum = $channelname->look_down('_tag' => 'span', 'class' => 'tvg_channelnumber'); # e.g. " - channel number 176"
! # my @shows = $channelname->parent->look_down('_tag' => 'span', 'class' => 'tvg_show');
! # $channelname = $channelname->as_text;
! #
! # begin workaround
! #
! # It looks like I can find the correct schedule block by comparing the 'tvg_channelname' block header with the page title:
! # get the page title
! # <title>BBC 2 TV listings | TV and radio | The Guardian </title>
! my $channeltitle = $tree->look_down('_tag' => 'title')->as_text;
! $channeltitle =~ m/^(.*)\sTV listings/ and $channeltitle = $1;
! print STDERR "TITLE= ".$channeltitle."\n" if $opt->{debug};
!
! # get the channel schedule(s) name
! my @channelscheds = $tree->look_down('_tag' => 'div', 'class' => 'tvg_channelname'); # e.g. "5 Star - channel number 176"
! my $channelsched;
! foreach (@channelscheds) {
! print STDERR $_->as_text."\n" if $opt->{debug};
! next if ($_->as_text !~ m/\Q$channeltitle - channel number/);
! print STDERR "FOUND= ".$_->as_text."\n" if $opt->{debug};
! $channelsched = $_;
! last;
! }
! my $channelname = $channelsched->as_text;
! print STDERR $channelname."\n" if $opt->{debug};
!
! # build the schedule from all the right nodes until we hit another 'tvg_channelname'
! my @shows;
! my $show = $channelsched;
! do {
! $show = $show->right();
! if ( $show && $show->tag() eq 'span' && $show->attr('class') eq 'tvg_show' ) {
! push @shows, $show;
! }
! } while defined $show && !( $show->tag() eq 'div' && $show->attr('class') eq 'tvg_channelname' );
! #
! # end workaround
!
!
if (@shows) {
foreach my $show (@shows) {
------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk