aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-07-11 18:28:13 -0700
committerFriendika <info@friendika.com>2011-07-11 18:28:13 -0700
commit180c15cdf86172edf58b071149e10af648ec90d4 (patch)
treea901e3dca7fa7d8a06683ba1fd5ad8de7f353e5b
parent2a65d01ce29eff486dcffc47c9d297e1eb7472ea (diff)
downloadvolse-hubzilla-180c15cdf86172edf58b071149e10af648ec90d4.tar.gz
volse-hubzilla-180c15cdf86172edf58b071149e10af648ec90d4.tar.bz2
volse-hubzilla-180c15cdf86172edf58b071149e10af648ec90d4.zip
zot scraper
-rw-r--r--boot.php2
-rw-r--r--include/Scrape.php24
2 files changed, 25 insertions, 1 deletions
diff --git a/boot.php b/boot.php
index ae7d94dac..88d72dec3 100644
--- 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' );
diff --git a/include/Scrape.php b/include/Scrape.php
index fbfec176f..3599d7df3 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -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);