X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FScrape.php;h=7df86d9f2d7cd4fe3d85372a85e8f80b61873cf9;hb=57c47a8e3660b8b968b36ff7b379f51aa398a684;hp=629f7a063bf3ba409177495caa21a4cbcca3e582;hpb=a21fe4059b3870a0ad24bf73df7a0c2edc5925b7;p=friendica.git diff --git a/include/Scrape.php b/include/Scrape.php index 629f7a063b..7df86d9f2d 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -343,6 +343,12 @@ function probe_url($url, $mode = PROBE_NORMAL) { if(! $url) return $result; + $result = Cache::get("probe_url:".$mode.":".$url); + if (!is_null($result)) { + $result = unserialize($result); + return $result; + } + $network = null; $diaspora = false; $diaspora_base = ''; @@ -350,6 +356,23 @@ function probe_url($url, $mode = PROBE_NORMAL) { $diaspora_key = ''; $has_lrdd = false; $email_conversant = false; + $connectornetworks = false; + $appnet = false; + + if (strpos($url,'twitter.com')) { + $connectornetworks = true; + $network = NETWORK_TWITTER; + } + + if (strpos($url,'www.facebook.com')) { + $connectornetworks = true; + $network = NETWORK_FACEBOOK; + } + + if (strpos($url,'alpha.app.net')) { + $appnet = true; + $network = NETWORK_APPNET; + } // Twitter is deactivated since twitter closed its old API //$twitter = ((strpos($url,'twitter.com') !== false) ? true : false); @@ -357,7 +380,7 @@ function probe_url($url, $mode = PROBE_NORMAL) { $at_addr = ((strpos($url,'@') !== false) ? true : false); - if((! $twitter) && (! $lastfm)) { + if((!$appnet) && (!$lastfm) && !$connectornetworks) { if(strpos($url,'mailto:') !== false && $at_addr) { $url = str_replace('mailto:','',$url); @@ -401,6 +424,9 @@ function probe_url($url, $mode = PROBE_NORMAL) { $pubkey = $diaspora_key; $diaspora = true; } + if($link['@attributes']['rel'] === 'http://ostatus.org/schema/1.0/subscribe') { + $diaspora = false; + } } // Status.Net can have more than one profile URL. We need to match the profile URL @@ -597,13 +623,16 @@ function probe_url($url, $mode = PROBE_NORMAL) { // Will leave it to others to figure out how to grab the avatar, which is on the $url page in the open graph meta links } - if($twitter || ! $poll) + if($appnet || ! $poll) $check_feed = true; if((! isset($vcard)) || (! x($vcard,'fn')) || (! $profile)) $check_feed = true; if(($at_addr) && (! count($links))) $check_feed = false; + if ($connectornetworks) + $check_feed = false; + if($check_feed) { $feedret = scrape_feed(($poll) ? $poll : $url); @@ -759,5 +788,7 @@ function probe_url($url, $mode = PROBE_NORMAL) { $result = $result2; } + Cache::set("probe_url:".$mode.":".$url,serialize($result)); + return $result; }