diff options
author | Friendika <info@friendika.com> | 2011-04-04 20:40:31 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-04-04 20:40:31 -0700 |
commit | 4c5e091b784574337c7124b7763bbd19f4bc810f (patch) | |
tree | 1abf46a183faf5e7993426c592d60a26cb246842 /include | |
parent | 793967a1d3c23fcf1f3b00a2832f51e6f473f4bd (diff) | |
download | volse-hubzilla-4c5e091b784574337c7124b7763bbd19f4bc810f.tar.gz volse-hubzilla-4c5e091b784574337c7124b7763bbd19f4bc810f.tar.bz2 volse-hubzilla-4c5e091b784574337c7124b7763bbd19f4bc810f.zip |
better twitter follow support
Diffstat (limited to 'include')
-rw-r--r-- | include/Scrape.php | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/include/Scrape.php b/include/Scrape.php index 21820ddaf..002fdfb35 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -227,16 +227,36 @@ function scrape_feed($url) { if(! $dom) return $ret; + + $items = $dom->getElementsByTagName('img'); + + // get img elements (twitter) + + if($items) { + foreach($items as $item) { + $x = $item->getAttribute('id'); + if($x === 'profile-image') { + $ret['photo'] = $item->getAttribute('src'); + } + } + } + $items = $dom->getElementsByTagName('link'); - // get Atom link elements + // get Atom/RSS link elements, take the first one of either. - foreach($items as $item) { - $x = $item->getAttribute('rel'); - if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml')) - $ret['feed_atom'] = $item->getAttribute('href'); - if(($x === 'alternate') && ($item->getAttribute('type') === 'application/rss+xml')) - $ret['feed_rss'] = $item->getAttribute('href'); + if($items) { + foreach($items as $item) { + $x = $item->getAttribute('rel'); + if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml')) { + if(! x($ret,'feed_atom')) + $ret['feed_atom'] = $item->getAttribute('href'); + } + if(($x === 'alternate') && ($item->getAttribute('type') === 'application/rss+xml')) { + if(! x($ret,'feed_rss')) + $ret['feed_rss'] = $item->getAttribute('href'); + } + } } return $ret; |