xmltv/grab/nl tv_grab_nl,1.77,1.78
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-serv18522
Modified Files:
tv_grab_nl
Log Message:
(minor) fix badiso8859 warning (faster method)
(minor) extend web page cache to 4 hours
Index: tv_grab_nl
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/nl/tv_grab_nl,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** tv_grab_nl 30 Apr 2014 18:28:23 -0000 1.77
--- tv_grab_nl 1 May 2014 06:19:26 -0000 1.78
***************
*** 183,187 ****
HTTP::Cache::Transparent::init( {
BasePath => get_default_cachedir(),
! NoUpdate => 60*60, # cache time in seconds
MaxAge => 24, # flush time in hours
Verbose => $opt_debug,
--- 183,187 ----
HTTP::Cache::Transparent::init( {
BasePath => get_default_cachedir(),
! NoUpdate => 4*3600, # cache time in seconds
MaxAge => 24, # flush time in hours
Verbose => $opt_debug,
***************
*** 413,417 ****
#my $warned_bad_chars;
! #sub tidy( $ ) {
# for (my $tmp = shift) {
# tr/\221\222/''/;
--- 413,417 ----
#my $warned_bad_chars;
! #sub tidypage( $ ) {
# for (my $tmp = shift) {
# tr/\221\222/''/;
***************
*** 423,432 ****
#}
! # Remove bad chars
sub tidy( $ ) {
! $_[0] =~ s/(\s) /$1/og; # replace 'space- ' with 'space'
! $_[0] =~ s/ / /og; # replace any remaining with space
! $_[0] =~ s/­//og; # delete soft hyphens
! return $_[0];
}
--- 423,442 ----
#}
! # Remove bad chars from entire page
! sub tidypage( $ ) {
! my $html = shift;
! $html =~ s/(\s) /$1/og; # replace 'space- ' with 'space'
! $html =~ s/ / /og; # replace any remaining with space
! $html =~ s/­//og; # delete soft hyphens
! return $html;
! }
!
! # Remove bad chars from an element
sub tidy( $ ) {
! my $html = shift;
! $html =~ s/(\s)\xA0/$1/og; # replace 'space- ' with 'space'
! $html =~ s/\xA0/ /og; # replace any remaining with space
! $html =~ s/\xAD//og; # delete soft hyphens
! return $html;
}
***************
*** 684,692 ****
# Get HTML::TreeBuilder object.
my $t;
! # why "tidy"? what's wrong with them?
! # eval { $t = get_nice_tree $url, \&tidy };
#
# page is "charset=iso-8859-1"
! $t = get_nice_tree($url, \&tidy);
if ($@) {
warn "error getting/parsing $url: $@";
--- 694,701 ----
# Get HTML::TreeBuilder object.
my $t;
! # eval { $t = get_nice_tree $url, \&tidypage };
#
# page is "charset=iso-8859-1"
! $t = get_nice_tree($url);
if ($@) {
warn "error getting/parsing $url: $@";
***************
*** 706,710 ****
$_s->detach();
}
! $$p->{'desc'} = trim( $_p->as_text() );
$_p->detach();
}
--- 715,719 ----
$_s->detach();
}
! $$p->{'desc'} = trim( tidy( $_p->as_text() ) );
$_p->detach();
}
***************
*** 714,718 ****
$html =~ s/(<br>|<br \/>)/ /sg; # insert spaces between paragraphs
$html =~ s/<.+?>//sg; # dump the html
! $$p->{'desc_add'} = trim( $html );
}
}
--- 723,727 ----
$html =~ s/(<br>|<br \/>)/ /sg; # insert spaces between paragraphs
$html =~ s/<.+?>//sg; # dump the html
! $$p->{'desc_add'} = trim( tidy( $html ) );
}
}
***************
*** 736,740 ****
#
foreach my $_li (@_li) {
! my $li = $_li->as_text();
if ( $li =~ /Genre:(.*)/ ) {
--- 745,749 ----
#
foreach my $_li (@_li) {
! my $li = tidy( $_li->as_text() );
if ( $li =~ /Genre:(.*)/ ) {
***************
*** 761,765 ****
#
foreach my $_li (@_li) {
! my $li = $_li->as_text();
if ( $li =~ /Jaar.*:(.*)/ ) {
--- 770,774 ----
#
foreach my $_li (@_li) {
! my $li = tidy( $_li->as_text() );
if ( $li =~ /Jaar.*:(.*)/ ) {
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos. Get
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs