Improvements how gcontact entries are updated

This commit is contained in:
Michael Vogel 2016-02-13 12:26:58 +01:00
parent 036311237f
commit 2ca6cdf6b6
7 changed files with 133 additions and 214 deletions

View file

@ -12,6 +12,18 @@ function scrape_dfrn($url, $dont_probe = false) {
logger('scrape_dfrn: url=' . $url);
// Try to fetch the data from noscrape. This is faster than parsing the HTML
$noscrape = str_replace("/hcard/", "/noscrape/", $url);
$noscrapejson = fetch_url($noscrape);
$noscrapedata = array();
if ($noscrapejson) {
$noscrapedata = json_decode($noscrapejson, true);
if (is_array($noscrapedata))
if ($noscrapedata["nick"] != "")
return($noscrapedata);
}
$s = fetch_url($url);
if(! $s)
@ -91,8 +103,7 @@ function scrape_dfrn($url, $dont_probe = false) {
}
}
}
return $ret;
return array_merge($ret, $noscrapedata);
}}