Finance/Quote/Morningstarde.pm: parse dynamic table-row for currency
This commit is contained in:
parent
a56620543e
commit
960ad436f6
@ -84,7 +84,9 @@ sub morningstarde
|
||||
$info{$stock,'name'} = $namestr;
|
||||
};
|
||||
|
||||
my $pricestr = $parser->findnodes('//div[@id="overviewQuickstatsDiv"]//tr[2]/td[3]');
|
||||
my $row = 2;
|
||||
while (!defined($info{$stock,'currency'}) && $row <=10) {
|
||||
my $pricestr = $parser->findnodes('//div[@id="overviewQuickstatsDiv"]//tr[' . $row . ']/td[3]');
|
||||
if (defined($pricestr)) {
|
||||
my @splitvals = ( $pricestr =~ /(\w+).([0-9,.]+)/g);
|
||||
if (@splitvals) {
|
||||
@ -94,7 +96,14 @@ sub morningstarde
|
||||
$converted_price =~ s/,/./g;
|
||||
$info{$stock,'nav'} = $converted_price;
|
||||
}
|
||||
|
||||
# if it does not look like a currency, try next row
|
||||
if ($info{$stock,'currency'} !~ /\w{2,3}/) {
|
||||
undef $info{$stock,'currency'};
|
||||
}
|
||||
$row++;
|
||||
};
|
||||
}
|
||||
|
||||
my $datestr = $parser->findnodes('//div[@id="overviewQuickstatsDiv"]//tr[2]/td[1]//span');
|
||||
if (defined($datestr)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user