Thread Web::Scraper unter anderem
(8 answers)
Opened by chmod777 at 2021-06-03 16:14 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 use v5.12; use warnings; use Data::Dumper; use Web::Scraper; use URI; # website to scrape my $urlToScrape = "https://www.finanzen.net/index/dow_jones/werte"; # prepare data my $names = scraper { # we will save the urls process ".table.table-small.table-hover > tr > td > a", 'urls[]' => '@href'; }; # scrape the data my $res = $names->scrape(URI->new($urlToScrape)); #print Dumper $res; my @urls; for my $cur_uri (@{ $res->{urls} }) { my $url = $cur_uri->as_string(); say "Add $url to array."; push @urls, $url; } Schönes Wochenende! Edit: use v5.12 statt 5.10 und use warnings hinzugefügt. Last edited: 2021-06-04 17:06:35 +0200 (CEST) Pörl.
|