From dd5da99a30a81a9ea56952f286feed81dd2edf11 Mon Sep 17 00:00:00 2001 From: Antoine Turmel Date: Sat, 7 Sep 2019 18:43:06 +0200 Subject: [PATCH] [StoriesIGBridge] New bridge (#1187) * Create StoriesIGBridge.php --- bridges/StoriesIGBridge.php | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 bridges/StoriesIGBridge.php diff --git a/bridges/StoriesIGBridge.php b/bridges/StoriesIGBridge.php new file mode 100644 index 00000000000..ddf9846b145 --- /dev/null +++ b/bridges/StoriesIGBridge.php @@ -0,0 +1,47 @@ + array( + 'name' => 'Instagram username', + 'type' => 'text', + 'required' => true, + 'title' => 'Insert the username here' + ), + ) + ); + + public function collectData(){ + $html = getSimpleHTMLDOM($this->getURI()) + or returnServerError('Failed to receive ' . $this->getURI()); + + $results = $html->find('article'); + + foreach($results as $result) { + + $item = array(); + + $item['title'] = $this->getInput('username') . ' story'; + $item['uri'] = $result->find('div.download', 0)->find('a', 0)->href; + $item['author'] = $this->getInput('username'); + $item['uid'] = $result->find('time', 0)->datetime; + + $item['content'] = $result; + + $this->items[] = $item; + } + } + + public function getURI(){ + $uri = self::URI . '/stories/'; + $uri .= urlencode($this->getInput('username')); + return $uri; + + return parent::getURI(); + } +}