Skip to content

Commit

Permalink
Throttle calls to dbpedia
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jan 1, 2024
1 parent ecf4496 commit cb945ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ if($opts{'w'} || $opts{'B'} || $opts{'M'}) {
cachename_spec => {
_body => '',
_headers => []
}
},
);
$cached_browser->env_proxy(1);
$cached_browser->conn_cache->total_capacity(undef);
Expand Down Expand Up @@ -670,6 +670,7 @@ if(((!$opts{'T'}) && (!$opts{'O'} && (!$opts{'S'}))) || $opts{'v'}) {
'api.geonames.org' => 1,
'yboss.yahooapis.com' => 1, # Geo::Coder::PlaceFinder
'www.familysearch.org' => 1,
'lookup.dbpedia.org' => 1,
});
# G::C::GooglePlaces
$browser->throttle({ 'maps.googleapis.com' => 0.1 }) unless($ENV{GMAP_KEY});
Expand Down Expand Up @@ -12461,7 +12462,7 @@ sub dbpedia

my $url = "https://lookup.dbpedia.org/api/search?query=$firstname%20$surname";
print "$url\n" if($opts{'v'});
if(($firstname ne '?') && (my $resp = $cached_browser->get($url))) {
if(($firstname ne '?') && (my $resp = $browser->get($url))) {
if($resp->is_success()) {
if(my $arrayofresults = XML::Hash->new()->fromXMLStringtoHash($resp->decoded_content())->{'ArrayOfResults'}) {
RESULT: foreach my $result(@{$arrayofresults->{'Result'}}) {
Expand Down

0 comments on commit cb945ef

Please sign in to comment.