Finance/Quote/DKB.pm: update URLS and Parsing

This commit is contained in:
Matthias Merz 2018-11-13 21:42:54 +01:00
parent 40472fd8bc
commit 319fa34f8d

View File

@ -23,18 +23,18 @@ use HTML::TreeBuilder::XPath;
my $agent_string = 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0';
my %urlmap_wkn = (
'532656' => 'https://dkb.mdgms.com/MIS/?id_instrument=4071891&id=0107980&pid=DKB_fnd_profile&id_notation=3688058',
'974515' => 'https://dkb.mdgms.com/MIS/?id_instrument=102918&id=0107980&pid=DKB_fnd_profile&id_notation=3228063',
'a0dpw0' => 'https://dkb.mdgms.com/MIS/?id_instrument=11659733&id=0107980&pid=DKB_fnd_profile&id_notation=11014630',
'a0m430' => 'https://dkb.mdgms.com/MIS/?id_instrument=18085585&id=0107980&pid=DKB_fnd_profile&id_notation=20644387',
'a0m8hd' => 'https://dkb.mdgms.com/MIS/?id_instrument=19179789&id=0107980&pid=DKB_fnd_profile&id_notation=21240603',
'a0m9a2' => 'https://dkb.mdgms.com/MIS/?id_instrument=19035880&id=0107980&pid=DKB_fnd_profile&id_notation=23679474',
'a0ndda' => 'https://dkb.mdgms.com/MIS/?id_instrument=25204090&id=0107980&pid=DKB_fnd_profile&id_notation=31156472',
'a0x754' => 'https://dkb.mdgms.com/MIS/?id_instrument=22407622&id=0107980&pid=DKB_fnd_profile&id_notation=26567264',
'a0x758' => 'https://dkb.mdgms.com/MIS/?id_instrument=22533730&id=0107980&pid=DKB_fnd_profile&id_notation=26567263',
'a0ya5q' => 'https://dkb.mdgms.com/MIS/?id_instrument=26097198&id=0107980&pid=DKB_fnd_profile&id_notation=32652184',
'dws0pr' => 'https://dkb.mdgms.com/MIS/?id_instrument=18286450&id=0107980&pid=DKB_fnd_profile&id_notation=22946309',
'ewg0ld' => 'https://dkb.mdgms.com/MIS/?pid=DKB_cer_portrait&id_instrument=55061564&id_notation=70580062&id=0107980'
'532656' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=4071891&id_notation=3688058&id=0107980',
'974515' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=102918&id_notation=3228063&id=0107980',
'a0dpw0' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=11659733&id_notation=11014630&id=0107980',
'a0m430' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=18085585&id_notation=20644387&id=0107980',
'a0m8hd' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=19179789&id_notation=21240603&id=0107980',
'a0m9a2' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=19035880&id_notation=23679474&id=0107980',
'a0ndda' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=25204090&id_notation=31156472&id=0107980',
'a0x754' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=22407622&id_notation=26567264&id=0107980',
'a0x758' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=22533730&id_notation=26567263&id=0107980',
'a0ya5q' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=26097198&id_notation=32652184&id=0107980',
'dws0pr' => 'https://kurse.dkb.de/MIS/?pid=dkb_fnd_details&id_instrument=18286450&id_notation=22946309&id=0107980',
'ewg0ld' => 'https://kurse.dkb.de/MIS/?pid=dkb_cer_details&id_instrument=55061564&id_notation=70580062&id=0107980'
);
my %wknmap = (
@ -97,11 +97,11 @@ sub dkb
$info{$stock,'symbol'} = $stock;
my $parser = HTML::TreeBuilder::XPath->new_from_content($response->decoded_content);
my @names = $parser->findnodes( '//span[@class="dkbPortraitName"]');
my @names = $parser->findnodes( '//span[@class="h2"]');
if (@names) {
$info{$stock,'name'} = $names[0]->as_text;
};
my @prices = $parser->findnodes( '//span[@class="dkbPortraitPrice"]');
my @prices = $parser->findnodes( '//span[@class="quote"]');
if (@prices) {
my $pricestr = $prices[0]->as_text;
my @splitvals = ( $pricestr =~ /((\d|,|\.)*)\s*/g);
@ -111,16 +111,17 @@ sub dkb
$converted_price =~ s/,/./g;
$info{$stock,'price'} = $converted_price;
$info{$stock,'last'} = $converted_price;
if ($pricestr =~ /EUR/) {
$info{$stock,'currency'} = 'EUR';
}
}
};
my @dates = $parser->findnodes( '//span[@class="dkbPortraitDate"]');
if (@dates) {
#$info{$stock,'date'} = $dates[0]->as_text;
$quoter->store_date(\%info, $stock, {eurodate => $dates[0]->as_text});
my @units = $parser->findnodes( '//span[@class="unit"]');
if (@units) {
$info{$stock,'currency'} = $units[0]->as_text;
};
#my @dates = $parser->findnodes( '//span[@class="dkbPortraitDate"]');
#if (@dates) {
# #$info{$stock,'date'} = $dates[0]->as_text;
# $quoter->store_date(\%info, $stock, {eurodate => $dates[0]->as_text});
#};
$info{$stock,'timezone'} = 'Europe/Berlin';
#$info{$stock,'currency'} = 'EUR';
}