diff --git a/bridges/DanbooruBridge.php b/bridges/DanbooruBridge.php index 9e9606ed..d6337f6b 100644 --- a/bridges/DanbooruBridge.php +++ b/bridges/DanbooruBridge.php @@ -15,7 +15,9 @@ class DanbooruBridge extends BridgeAbstract { 'type' => 'number' ), 't' => array( - 'name' => 'tags' + 'type' => 'text', + 'name' => 'tags', + 'exampleValue' => 'cosplay', ) ), 0 => array() diff --git a/bridges/FSecureBlogBridge.php b/bridges/FSecureBlogBridge.php index f39462f2..46ad8ac0 100644 --- a/bridges/FSecureBlogBridge.php +++ b/bridges/FSecureBlogBridge.php @@ -18,7 +18,7 @@ class FSecureBlogBridge extends BridgeAbstract { ), 'oldest_date' => array( 'name' => 'Oldest article date', - 'exampleValue' => '-2 months', + 'exampleValue' => '-6 months', ), ) ); diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php index 72581200..7dcd44fc 100644 --- a/bridges/GelbooruBridge.php +++ b/bridges/GelbooruBridge.php @@ -68,6 +68,7 @@ class GelbooruBridge extends BridgeAbstract { public function collectData(){ $content = getContents($this->getFullURI()); + // $content is empty string // Most other Gelbooru-based boorus put their content in the root of // the JSON. This check is here for Bridges that inherit from this one diff --git a/bridges/KhinsiderBridge.php b/bridges/KhinsiderBridge.php index 38e10c45..943457c5 100644 --- a/bridges/KhinsiderBridge.php +++ b/bridges/KhinsiderBridge.php @@ -13,6 +13,7 @@ class KhinsiderBridge extends BridgeAbstract $html = getSimpleHTMLDOM(self::URI); $dates = $html->find('#EchoTopic h3'); + // $dates is empty foreach ($dates as $date) { $item = array(); $item['uri'] = self::URI; diff --git a/bridges/KununuBridge.php b/bridges/KununuBridge.php index 6ac06df2..42203f8f 100644 --- a/bridges/KununuBridge.php +++ b/bridges/KununuBridge.php @@ -17,7 +17,8 @@ class KununuBridge extends BridgeAbstract { 'Germany' => 'de', 'Switzerland' => 'ch', 'United States' => 'us' - ) + ), + 'exampleValue' => 'de', ), 'full' => array( 'name' => 'Load full article', @@ -46,7 +47,7 @@ class KununuBridge extends BridgeAbstract { 'company' => array( 'name' => 'Company', 'required' => true, - 'exampleValue' => 'kununu-us', + 'exampleValue' => 'adesso', 'title' => 'Insert company name (i.e. Kununu US) or URI path (i.e. kununu-us)' ) ) @@ -72,7 +73,8 @@ class KununuBridge extends BridgeAbstract { break; } - return self::URI . $site . '/' . $company . '/' . $section . '?sort=update_time_desc'; + $url = sprintf('%s%s/%s/%s?sort=update_time_desc', self::URI, $site, $company, $section); + return $url; } return parent::getURI(); @@ -91,6 +93,9 @@ class KununuBridge extends BridgeAbstract { return 'https://www.kununu.com/favicon-196x196.png'; } + /** + * All css selectors need rework + */ public function collectData(){ $full = $this->getInput('full'); diff --git a/bridges/LegifranceJOBridge.php b/bridges/LegifranceJOBridge.php index 41a9b069..cfbfad46 100644 --- a/bridges/LegifranceJOBridge.php +++ b/bridges/LegifranceJOBridge.php @@ -3,6 +3,7 @@ class LegifranceJOBridge extends BridgeAbstract { const MAINTAINER = 'Pierre Mazière'; const NAME = 'Journal Officiel de la République Française'; + // This uri returns a snippet of js. Should probably be https://www.legifrance.gouv.fr/jorf/jo/ const URI = 'https://www.legifrance.gouv.fr/affichJO.do'; const DESCRIPTION = 'Returns the laws and decrees officially registered daily in France'; diff --git a/bridges/MsnMondeBridge.php b/bridges/MsnMondeBridge.php index 3122d5d2..9c418bd9 100644 --- a/bridges/MsnMondeBridge.php +++ b/bridges/MsnMondeBridge.php @@ -20,6 +20,8 @@ class MsnMondeBridge extends BridgeAbstract { $html = getSimpleHTMLDOM($this->getURI()); $limit = 0; + + // TODO: fix why articles is empty foreach($html->find('.smalla') as $article) { if($limit < 10) { $item = array(); diff --git a/bridges/PillowfortBridge.php b/bridges/PillowfortBridge.php index 788a2985..b2c7062c 100644 --- a/bridges/PillowfortBridge.php +++ b/bridges/PillowfortBridge.php @@ -9,7 +9,7 @@ class PillowfortBridge extends BridgeAbstract { 'name' => 'Username', 'type' => 'text', 'required' => true, - 'exampleValue' => 'vaxis2', + 'exampleValue' => 'SomniumAeterna', ), 'noava' => array( 'name' => 'Hide avatar', @@ -39,6 +39,29 @@ class PillowfortBridge extends BridgeAbstract { ) )); + /** + * The Pillowfort bridge. + * + * Pillowfort pages are dynamically generated from a json file + * which holds the last 20 or so posts from the given user. + * This bridge uses that json file and HTML/CSS similar + * to the Twitter bridge for formatting. + */ + public function collectData() { + $jsonSite = getContents($this->getJSONURI()); + + $jsonFile = json_decode($jsonSite, true); + $posts = $jsonFile['posts']; + + foreach($posts as $post) { + $item = $this->getItemFromPost($post); + + //empty when 'noreblogs' is checked and current post is a reblog. + if(!empty($item)) + $this->items[] = $item; + } + } + public function getName() { $name = $this -> getUsername(); if($name != '') @@ -56,7 +79,7 @@ class PillowfortBridge extends BridgeAbstract { } protected function getJSONURI() { - return $this -> getURI() . '/json'; + return $this -> getURI() . '/json/?p=1'; } protected function getUsername() { @@ -196,27 +219,4 @@ EOD; return $item; } - - /** - * The Pillowfort bridge. - * - * Pillowfort pages are dynamically generated from a json file - * which holds the last 20 or so posts from the given user. - * This bridge uses that json file and HTML/CSS similar - * to the Twitter bridge for formatting. - */ - public function collectData() { - $jsonSite = getContents($this -> getJSONURI()); - - $jsonFile = json_decode($jsonSite, true); - $posts = $jsonFile['posts']; - - foreach($posts as $post) { - $item = $this->getItemFromPost($post); - - //empty when 'noreblogs' is checked and current post is a reblog. - if(!empty($item)) - $this->items[] = $item; - } - } } diff --git a/bridges/RobinhoodSnacksBridge.php b/bridges/RobinhoodSnacksBridge.php index 8188be64..313c6386 100644 --- a/bridges/RobinhoodSnacksBridge.php +++ b/bridges/RobinhoodSnacksBridge.php @@ -11,7 +11,9 @@ class RobinhoodSnacksBridge extends BridgeAbstract { { $html = getSimpleHTMLDOM(self::URI); - foreach ($html->find('#root > div > div > div > div > div > a') as $element) { + $elements = $html->find('#__next > div > div > div > div > div > a'); + + foreach ($elements as $element) { if ($element->href === 'https://snacks.robinhood.com/newsletters/page/2/') { continue; } diff --git a/bridges/TorrentGalaxyBridge.php b/bridges/TorrentGalaxyBridge.php index e7d42a7e..22f839ef 100644 --- a/bridges/TorrentGalaxyBridge.php +++ b/bridges/TorrentGalaxyBridge.php @@ -67,7 +67,13 @@ class TorrentGalaxyBridge extends BridgeAbstract { $item = array(); $item['uri'] = self::URI . $identity->href; $item['title'] = $identity->plaintext; - $item['timestamp'] = DateTime::createFromFormat('d/m/y H:i', $creadate)->format('U'); + + // todo: parse date strings such as '1Hr ago' etc. + $createdAt = DateTime::createFromFormat('d/m/y H:i', $creadate); + if ($createdAt) { + $item['timestamp'] = $createdAt->format('U'); + } + $item['author'] = $authorid->plaintext; $item['content'] = <<{$identity->plaintext} diff --git a/bridges/ViadeoCompanyBridge.php b/bridges/ViadeoCompanyBridge.php index 17550aaa..fd1a29b6 100644 --- a/bridges/ViadeoCompanyBridge.php +++ b/bridges/ViadeoCompanyBridge.php @@ -17,21 +17,24 @@ class ViadeoCompanyBridge extends BridgeAbstract { )); public function collectData(){ - $html = ''; - $link = self::URI . 'fr/company/' . $this->getInput('c'); + // Redirects to https://emploi.lefigaro.fr/recherche/entreprises + $url = sprintf('%sfr/company/%s', self::URI, $this->getInput('c')); - $html = getSimpleHTMLDOM($link); + $html = getSimpleHTMLDOM($url); - foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) { + // TODO: Fix broken xpath selector + $elements = $html->find('//*[@id="company-newsfeed"]/ul/li'); + + foreach($elements as $element) { $title = $element->find('p', 0)->innertext; - if($title) { - $item = array(); - $item['uri'] = $link; - $item['title'] = mb_substr($element->find('p', 0)->innertext, 0, 100); - $item['content'] = $element->find('p', 0)->innertext;; - $this->items[] = $item; - $i++; + if(!$title) { + continue; } + $item = array(); + $item['uri'] = $url; + $item['title'] = mb_substr($element->find('p', 0)->innertext, 0, 100); + $item['content'] = $element->find('p', 0)->innertext;; + $this->items[] = $item; } } } diff --git a/bridges/ZenodoBridge.php b/bridges/ZenodoBridge.php index 2ed2145f..467ecb4f 100644 --- a/bridges/ZenodoBridge.php +++ b/bridges/ZenodoBridge.php @@ -1,4 +1,5 @@ find('p', 0)->find('span') as $authors) { - $item['author'] = $item['author'] . $authors . '; '; + + $p1 = $element->find('p', 0); + if ($p1) { + foreach ($p1->find('span') as $authors) { + $item['author'] = $item['author'] . $authors . '; '; + } } - $content = $element->find('p.hidden-xs', 0)->find('a', 0)->innertext . '
'; + + $p2 = $element->find('p.hidden-xs', 0); + if ($p2) { + $content = $p2->find('a', 0)->innertext . '
'; + } else { + $content = 'Nope'; + } + $type = '
Type: ' . $element->find('span.label-default', 0)->innertext; $raw_date = $element->find('small.text-muted', 0)->innertext;