xmltv/grab/na_dtv tv_grab_na_dtv,1.19,1.20
Geoff <[email protected]>
| Newsgroups | gmane.comp.tv.xmltv.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xmltv/xmltv/grab/na_dtv
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv6510
Modified Files:
tv_grab_na_dtv
Log Message:
Use LWP::UserAgent instead of WWW::Mechanize (which is known to have memory leaks, esp. in older versions) (c.f. bug #363)
Index: tv_grab_na_dtv
===================================================================
RCS file: /cvsroot/xmltv/xmltv/grab/na_dtv/tv_grab_na_dtv,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** tv_grab_na_dtv 8 Jan 2012 13:54:00 -0000 1.19
--- tv_grab_na_dtv 23 May 2014 15:38:18 -0000 1.20
***************
*** 94,101 ****
use XMLTV::Configure::Writer;
use XMLTV::Options qw/ParseOptions/;
! use WWW::Mechanize;
use HTML::TokeParser;
use DateTime;
! use JSON;
use Errno qw(EAGAIN);
--- 94,102 ----
use XMLTV::Configure::Writer;
use XMLTV::Options qw/ParseOptions/;
! use LWP::UserAgent;
! use HTTP::Cookies;
use HTML::TokeParser;
use DateTime;
! use JSON::PP;
use Errno qw(EAGAIN);
***************
*** 267,275 ****
sub getBrowser {
my ($conf) = @_;
! my $browser = WWW::Mechanize->new();
! $browser->proxy( [ 'http', 'https' ], $conf->{proxy}->[0] )
if $conf->{proxy}->[0];
! $browser->agent_alias('Windows Mozilla');
! return $browser;
}
--- 268,289 ----
sub getBrowser {
my ($conf) = @_;
!
! my $ua = LWP::UserAgent->new;
!
! # Cookies
! my $cookies = HTTP::Cookies->new;
! $ua->cookie_jar($cookies);
!
! # Define user agent type
! $ua->agent('Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4b) Gecko/20030516 Mozilla Firebird/0.6');
!
! # Define timouts
! $ua->timeout(240);
!
! # Use proxy if set in http_proxy etc.
! $ua->proxy( [ 'http', 'https' ], $conf->{proxy}->[0] )
if $conf->{proxy}->[0];
!
! return $ua;
}
***************
*** 398,407 ****
my %params = ( "/directv/eportal/formhandler/EportalProfileFormHandler.profileUpdateForm.zipCode" => "$zip" );
print STDERR "Setting zip code\n" if ($DEBUG);
! $browser->post( $setZipUrl, Content => \%params );
print STDERR "Getting channel list\n" if ($DEBUG);
my $listUrl = $CHANNEL_LIST_URL . "?hideDupes=true&view=ALL&zipcode=${zip}";
! $browser->get($listUrl);
! my $json = $browser->content();
my $data = decode_json $json;
--- 412,421 ----
my %params = ( "/directv/eportal/formhandler/EportalProfileFormHandler.profileUpdateForm.zipCode" => "$zip" );
print STDERR "Setting zip code\n" if ($DEBUG);
! my $resp = $browser->post( $setZipUrl, Content => \%params );
print STDERR "Getting channel list\n" if ($DEBUG);
my $listUrl = $CHANNEL_LIST_URL . "?hideDupes=true&view=ALL&zipcode=${zip}";
! $resp = $browser->get($listUrl);
! my $json = $resp->content();
my $data = decode_json $json;
***************
*** 613,618 ****
blockduration => 24
);
! $browser->post( $SCHEDULE_URL, Content => \%params );
! my $json = $browser->content();
# Parse JSON
--- 627,632 ----
blockduration => 24
);
! my $resp = $browser->post( $SCHEDULE_URL, Content => \%params );
! my $json = $resp->content();
# Parse JSON
***************
*** 678,682 ****
}
! my $detailContent = $browser->content();
my $parser = HTML::TokeParser->new( \$detailContent );
--- 692,696 ----
}
! my $detailContent = $resp->content();
my $parser = HTML::TokeParser->new( \$detailContent );
------------------------------------------------------------------------------
"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