]> git.mxchange.org Git - friendica.git/commitdiff
zot scraper
authorFriendika <info@friendika.com>
Tue, 12 Jul 2011 01:28:13 +0000 (18:28 -0700)
committerFriendika <info@friendika.com>
Tue, 12 Jul 2011 01:28:13 +0000 (18:28 -0700)
boot.php
include/Scrape.php

index ae7d94dac6a1c5888c0cf2ab4b153af3ba62ebe4..88d72dec38362d116b9660b74cf36609322039cb 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -89,6 +89,7 @@ define ( 'PAGE_FREELOVE',          3 );
  * Network and protocol family types 
  */
 
+define ( 'NETWORK_ZOT',              'zot!');    // Zot!
 define ( 'NETWORK_DFRN',             'dfrn');    // Friendika, Mistpark, other DFRN implementations
 define ( 'NETWORK_OSTATUS',          'stat');    // status.net, identi.ca, GNU-social, other OStatus implementations
 define ( 'NETWORK_FEED',             'feed');    // RSS/Atom feeds with no known "post/notify" protocol
@@ -117,6 +118,7 @@ define ( 'NOTIFY_MAIL',    0x0010 );
  * various namespaces we may need to parse
  */
 
+define ( 'NAMESPACE_ZOT',             'http://purl.org/macgirvin/zot' );
 define ( 'NAMESPACE_DFRN' ,           'http://purl.org/macgirvin/dfrn/1.0' ); 
 define ( 'NAMESPACE_THREAD' ,         'http://purl.org/syndication/thread/1.0' );
 define ( 'NAMESPACE_TOMB' ,           'http://purl.org/atompub/tombstones/1.0' );
index fbfec176f8894d7cbc875bd81451d78b54c6d61d..3599d7df3eb7d8f0f6e06c84d3cfbe3d4a28dbd9 100644 (file)
@@ -300,6 +300,8 @@ function probe_url($url) {
                if(count($links)) {
                        logger('probe_url: found lrdd links: ' . print_r($links,true), LOGGER_DATA);
                        foreach($links as $link) {
+                               if($link['@attributes']['rel'] === NAMESPACE_ZOT)
+                                       $zot = unamp($link['@attributes']['href']);
                                if($link['@attributes']['rel'] === NAMESPACE_DFRN)
                                        $dfrn = unamp($link['@attributes']['href']);
                                if($link['@attributes']['rel'] === 'salmon')
@@ -379,6 +381,25 @@ function probe_url($url) {
                }
        }       
 
+       if(strlen($zot)) {
+               $s = fetch_url($zot);
+               if($s) {
+                       $j = json_decode($s);
+                       if($j) {
+                               $network = NETWORK_ZOT;
+                               $vcard   = array(
+                                       'fn'    => $j->name, 
+                                       'nick'  => $j->username, 
+                                       'photo' => $j->photo
+                               );
+                               $profile  = $j->url;
+                               $notify   = $j->post;
+                               $key      = $j->pubkey;
+                               $poll     = 'N/A';
+                       }
+               }
+       }
+
        if(strlen($dfrn)) {
                $ret = scrape_dfrn($dfrn);
                if(is_array($ret) && x($ret,'dfrn-request')) {
@@ -390,7 +411,7 @@ function probe_url($url) {
                }
        }
 
-       if($network !== NETWORK_DFRN && $network !== NETWORK_MAIL) {
+       if($network !== NETWORK_ZOT && $network !== NETWORK_DFRN && $network !== NETWORK_MAIL) {
                $network  = NETWORK_OSTATUS;
                $priority = 0;
 
@@ -549,6 +570,7 @@ function probe_url($url) {
        $result['priority'] = $priority;
        $result['network'] = $network;
        $result['alias'] = $alias;
+       $result['key'] = $key;
 
        logger('probe_url: ' . print_r($result,true), LOGGER_DEBUG);