pricecharts

track prices of consumer electronics
Log | Files | Refs | README

commit 68d6c33fc336854e50120897cafa90872851f01f
parent fcdf5e86f62d1bef428f9cc23c3b3148b3418f4a
Author: Kyle R W Milz <kyle@getaddrinfo.net>
Date:   Wed, 13 Aug 2014 01:38:22 -0600

various: rename "path" to "general" in config file

Diffstat:
MShared.pm | 6+++---
Mprice_scraper.pl | 5++---
Mpricechart.cfg | 8+++++---
3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/Shared.pm b/Shared.pm @@ -32,7 +32,7 @@ sub get_config } my $parser = Config::Grammar->new({ - _sections => ['vendors', 'paths'], + _sections => ['vendors', 'general'], vendors => { # vendor regular expression _sections => ['/[A-Za-z ]+/'], @@ -40,8 +40,8 @@ sub get_config _vars => ['search_uri', 'reg_price', 'sale_price', 'color'], }, }, - paths => { - _vars => ['http', 'log'], + general => { + _vars => ['http_path', 'log_path', 'user_agent'], }, }); diff --git a/price_scraper.pl b/price_scraper.pl @@ -29,7 +29,7 @@ if ($args{v}) { select STDOUT; } else { - open my $logfile, ">>", "$cfg->{paths}{log}" or die $!; + open my $logfile, ">>", "$cfg->{general}{log_path}" or die $!; select $logfile; } @@ -50,8 +50,7 @@ else { print strftime "%b %e %Y %H:%M ", localtime; printf "%-15s [", $part_no; -my $ua = LWP::UserAgent->new(agent => 'Mozilla/5.0'); -# some sites need this (amazon I think?) +my $ua = LWP::UserAgent->new(agent => $cfg->{general}{user_agent}); $ua->default_header('Accept' => '*/*'); for (sort keys $cfg->{vendors}) { diff --git a/pricechart.cfg b/pricechart.cfg @@ -1,7 +1,9 @@ -*** paths *** +*** general *** -http = /var/www/htdocs/pricegraph -log = pricegraph.txt +http_path = /var/www/htdocs/pricegraph +log_path = pricechart_log.txt +# Chrome 36 Win7 64bit +user_agent = Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36; *** vendors ***