From bad913c8060d383296c9516330ecc088d80acb71 Mon Sep 17 00:00:00 2001 From: Mitsukarenai Date: Thu, 15 Aug 2013 11:02:43 +0200 Subject: [PATCH 1/2] Add IdenticaBridge: get major user activity --- bridges/IdenticaBridge.php | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 bridges/IdenticaBridge.php diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php new file mode 100644 index 0000000..a31e1a6 --- /dev/null +++ b/bridges/IdenticaBridge.php @@ -0,0 +1,41 @@ +returnError('Requested username can\'t be found.', 404); + } + else { + $this->returnError('You must specify an Identica username (?u=...).', 400); + } + + foreach($html->find('li.major') as $dent) { + $item = new \Item(); + $item->uri = html_entity_decode($dent->find('a', 0)->href); // get dent link + $item->timestamp = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp + $item->content = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text + $item->title = $param['u'] . ' | ' . $item->content; + $this->items[] = $item; + } + } + + public function getName(){ + return 'Identica Bridge'; + } + + public function getURI(){ + return 'https://identica.com'; + } + + public function getCacheDuration(){ + return 300; // 5 minutes + } +} From dfd2110776c0ea036bf15e0b59a11beab293ab42 Mon Sep 17 00:00:00 2001 From: Mitsukarenai Date: Thu, 15 Aug 2013 12:05:58 +0200 Subject: [PATCH 2/2] Add: Youtube Bridge --- bridges/YoutubeBridge.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bridges/YoutubeBridge.php diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php new file mode 100644 index 0000000..fac0c76 --- /dev/null +++ b/bridges/YoutubeBridge.php @@ -0,0 +1,36 @@ +returnError('Could not request Youtube.', 404); + + foreach($html->find('li.channels-content-item') as $element) { + $item = new \Item(); + $item->uri = 'https://www.youtube.com'.$element->find('a',0)->href; + $item->thumbnailUri = 'https:'.$element->find('img',0)->src; + $item->title = trim($element->find('h3',0)->plaintext); + $item->content = '
' . $item->title . ''; + $this->items[] = $item; + } + } + + public function getName(){ + return 'Youtube Bridge'; + } + + public function getURI(){ + return 'https://www.youtube.com/'; + } + + public function getCacheDuration(){ + return 21600; // 6 hours + } +}