XMLConfig srcExtra = this.src.getExtra();
String srcIP = "";
if (srcExtra!=null) {
srcIP = srcExtra.getProperty("/geoip/ip", "");
}
GeoLocalisation geo;
try {
URL hostUrl = new URL(startingUrls.getUrlHome());
geo = new GeoLocalisation (hostUrl.getHost(), srcIP, null);
} catch (URISyntaxException e) {
e.printStackTrace();
return false;
} catch (MalformedURLException e) {
e.printStackTrace();
return false;
}
if (geo.resolve("geoiptool") && geo.hasChanged()) {
srcExtra.setProperty("/", "geoip", "");
srcExtra.setProperty("/geoip", "ip", geo.getIp());
srcExtra.setProperty("/geoip", "latitude", geo.getLatitude());
srcExtra.setProperty("/geoip", "longitude", geo.getLongitude());
srcExtra.setProperty("/geoip", "countrycode", geo.getCountryCode());
srcExtra.setProperty("/geoip", "countryname", geo.getCountryName());
srcExtra.setProperty("/geoip", "area", geo.getArea());
srcExtra.setProperty("/geoip", "city", geo.getCity());
this.src.setExtra(srcExtra);
}
}
String scriptPath = config.getProperty("/crawler/param[@name='scripts_path']", "");