xmltv/grab/nl tv_grab_nl,1.80,1.81

Geoff <[email protected]>
Newsgroups gmane.comp.tv.xmltv.cvs
Message-ID <[email protected]>
Update of /cvsroot/xmltv/xmltv/grab/nl
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15723

Modified Files:
	tv_grab_nl 
Log Message:
(major) fix broken details page grab (website changes)

Index: tv_grab_nl
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/nl/tv_grab_nl,v
retrieving revision 1.80
retrieving revision 1.81
diff -C2 -d -r1.80 -r1.81
*** tv_grab_nl	9 May 2014 10:30:14 -0000	1.80
--- tv_grab_nl	20 Jun 2015 09:59:08 -0000	1.81
***************
*** 458,462 ****
      my (@unique, %seen) = ((),());
      foreach ( @_ ) {
!       next if $seen{ $_ }++;
        push @unique, $_;
      	        }
--- 458,462 ----
      my (@unique, %seen) = ((),());
      foreach ( @_ ) {
!       next if $seen{ lc( $_ ) }++;
        push @unique, $_;
      	        }
***************
*** 597,602 ****
          #print STDERR "$tz : $p->{'start_epoch'} \n";
      	
!         push @{$p->{'genres'}}, $_p->{'genre'}  if ($_p->{'genre'} ne '');  # (e.g. Film) - put before soort
!         push @{$p->{'genres'}}, $_p->{'soort'}  if ($_p->{'soort'} ne '');
  			
          $p->{'url'}         = "http://www.tvgids.nl/programma/".$p->{'db_id'};
--- 597,602 ----
          #print STDERR "$tz : $p->{'start_epoch'} \n";
      	
!         push @{$p->{'genres'}}, trim( $_p->{'genre'} )  if ($_p->{'genre'} ne '');  # (e.g. Film) - put before soort
!         push @{$p->{'genres'}}, trim( $_p->{'soort'} )  if ($_p->{'soort'} ne '');
  			
          $p->{'url'}         = "http://www.tvgids.nl/programma/".$p->{'db_id'};
***************
*** 691,695 ****
  	
      local $SIG{__WARN__} = sub {
!     	warn "$url: $_[0]";
      };
  
--- 691,695 ----
  	
      local $SIG{__WARN__} = sub {
!     	warn "$url: $_[0]" unless (defined $_[0] && $_[0] =~ /^Parsing of undecoded UTF-/);
      };
  
***************
*** 698,702 ****
      #       eval { $t = get_nice_tree $url, \&tidypage };
      #
!     # page is "charset=iso-8859-1"
      $t = get_nice_tree($url);
      if ($@) {
--- 698,702 ----
      #       eval { $t = get_nice_tree $url, \&tidypage };
      #
!     # page is "charset=iso-8859-1" but sometimes contains UTF-8 !
      $t = get_nice_tree($url);
      if ($@) {
***************
*** 713,718 ****
      {
          if ( my $_p = $_div->look_down('_tag' => 'p') ) {
!             if ( my $_s = $_p->look_down('_tag' => 'strong') ) {
!                 push @{$$p->{'genres'}}, ( trim( $_s->as_text() ) );
                  $_s->detach();
              }
--- 713,719 ----
      {
          if ( my $_p = $_div->look_down('_tag' => 'p') ) {
!             if ( my $_s = $_p->look_down('_tag' => 'span', 'class' => qr/articleblock/ ) ) {
!                 # are there ever >1 genres here?
!                 push @{$$p->{'genres'}}, ( ucfirst(lc( trim( $_s->as_text() ) )) );
                  $_s->detach();
              }
***************
*** 729,742 ****
      }
      
!     # get the programme details box
!     $_div = $t->look_down('_tag' => 'div', 'id' => 'prog-info-content');
      if (not $_div) {
!     	warn "did not see 'prog-info-content' element, skipping";
!     	return;
      }
      {
!         if ( my $_ul = $_div->look_down('_tag' => 'ul', 'id' => 'prog-info-content-colleft') ) {
              my @_li = $_ul->look_down('_tag' => 'li');
! 	   	#
              # e.g.
              #     <li><strong>Titel:</strong>Elysium</li>
--- 730,744 ----
      }
      
!     # get the programme details
!     $_div = $t->look_down('_tag' => 'div', 'class' => 'programmering_details');
      if (not $_div) {
!         warn "did not see 'programmering_details' element, skipping";
!         return;
      }
      {
!         if ( my $_ul = $_div->look_down('_tag' => 'ul') ) {
              my @_li = $_ul->look_down('_tag' => 'li');
!             #
!             # DEPRECATED
              # e.g.
              #     <li><strong>Titel:</strong>Elysium</li>
***************
*** 751,765 ****
                  if ( $li =~ /Genre:(.*)/ ) {
                      push @{$$p->{'genres'}}, $1;
! 	    }
      
                  if ( $li =~ /Orginele titel:(.*)/ ) {
                      $$p->{'original_title'} = $1;
!   	       }
              }
          }
          
!         if ( my $_ul = $_div->look_down('_tag' => 'ul', 'id' => 'prog-info-content-colright') ) {
              my @_li = $_ul->look_down('_tag' => 'li');
              #
              # e.g.
              #     <li><strong>Jaar van premiere:</strong>2013</li>
--- 753,775 ----
                  if ( $li =~ /Genre:(.*)/ ) {
                      push @{$$p->{'genres'}}, $1;
!                 }
      
                  if ( $li =~ /Orginele titel:(.*)/ ) {
                      $$p->{'original_title'} = $1;
!                 }
              }
          }
+     }
          
!     $_div = $t->look_down('_tag' => 'div', 'class' => 'programmering_info_detail');
!     if (not $_div) {
!         warn "did not see 'programmering_info_detail' element, skipping";
!         return;
!     }
!     { 
!         if ( my $_ul = $_div->look_down('_tag' => 'ul') ) {
              my @_li = $_ul->look_down('_tag' => 'li');
              #
+             # DEPRECATED
              # e.g.
              #     <li><strong>Jaar van premiere:</strong>2013</li>
***************
*** 777,796 ****
                      $$p->{'year'} = $1;
                      next;
! 	       }
                  
                  if ( $li =~ /Regisseur.*:(.*)/ ) {
                      @{ $$p->{'directors'} } = split(/,/, $1);
                      next;
! 	    }
                  
                  if ( $li =~ /Acteurs.*:(.*)/ ) {
                      @{ $$p->{'actors'} } = split(/,/, $1);
                      next;
!         }
  
                  if ( $li =~ /Bijzonderheden:.*Breedbeeld.*/i ) {
                      $$p->{'widescreen'} = 1;
!     }
! 		
                  if ( my $_img = $_li->look_down('_tag' => 'img') ) {
                      my $src = $_img->attr('src');
--- 787,806 ----
                      $$p->{'year'} = $1;
                      next;
!                 }
                  
                  if ( $li =~ /Regisseur.*:(.*)/ ) {
                      @{ $$p->{'directors'} } = split(/,/, $1);
                      next;
!                 }
                  
                  if ( $li =~ /Acteurs.*:(.*)/ ) {
                      @{ $$p->{'actors'} } = split(/,/, $1);
                      next;
!                 }
  
                  if ( $li =~ /Bijzonderheden:.*Breedbeeld.*/i ) {
                      $$p->{'widescreen'} = 1;
!                 }
! 
                  if ( my $_img = $_li->look_down('_tag' => 'img') ) {
                      my $src = $_img->attr('src');


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.