From 4c48e85e12f5cdc41546f567651ae3931d2311e3 Mon Sep 17 00:00:00 2001 From: Mitsukarenai Date: Tue, 20 Jan 2015 19:06:51 +0100 Subject: [PATCH] Fixing, removing bridges --- bridges/DollbooruBridge.php | 8 ++--- bridges/GoogleSearchBridge.php | 4 +-- bridges/WakkuwakkuBridge.php | 54 ---------------------------------- 3 files changed, 6 insertions(+), 60 deletions(-) delete mode 100644 bridges/WakkuwakkuBridge.php diff --git a/bridges/DollbooruBridge.php b/bridges/DollbooruBridge.php index 6534ab8..631396e 100644 --- a/bridges/DollbooruBridge.php +++ b/bridges/DollbooruBridge.php @@ -2,7 +2,7 @@ /** * RssBridgeDollbooru * Returns images from given page -* 2014-05-25 +* 2015-01-20 * * @name Dollbooru * @homepage http://dollbooru.org/ @@ -23,12 +23,12 @@ class DollbooruBridge extends BridgeAbstract{ $html = file_get_html("http://dollbooru.org/post/list/$tags/$page") or $this->returnError('Could not request Dollbooru.', 404); - foreach($html->find('div[class=shm-image-list] center[class=shm-thumb]') as $element) { + foreach($html->find('div[class=shm-image-list] a') as $element) { $item = new \Item(); - $item->uri = 'http://dollbooru.org'.$element->find('a', 0)->href; + $item->uri = 'http://dollbooru.org'.$element->href; $item->postid = (int)preg_replace("/[^0-9]/",'', $element->getAttribute('data-post-id')); $item->timestamp = time(); - $item->thumbnailUri = 'http://dollbooru.org'.$element->find('img', 0)->getAttribute('data-original'); + $item->thumbnailUri = 'http://dollbooru.org'.$element->find('img', 0)->src; $item->tags = $element->getAttribute('data-tags'); $item->title = 'Dollbooru | '.$item->postid; $item->content = '
Tags: '.$item->tags; diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php index 4e6a61c..464b902 100644 --- a/bridges/GoogleSearchBridge.php +++ b/bridges/GoogleSearchBridge.php @@ -25,7 +25,7 @@ class GoogleSearchBridge extends BridgeAbstract{ if (isset($param['q'])) { /* keyword search mode */ $this->request = $param['q']; - $html = file_get_html('http://www.google.com/search?q=' . urlencode($this->request) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnError('No results for this query.', 404); + $html = file_get_html('https://www.google.com/search?q=' . urlencode($this->request) . '&num=100&complete=0&tbs=qdr:y,sbd:1') or $this->returnError('No results for this query.', 404); } else{ $this->returnError('You must specify a keyword (?q=...).', 400); @@ -38,7 +38,7 @@ class GoogleSearchBridge extends BridgeAbstract{ // Extract direct URL from google href (eg. /url?q=...) $t = $element->find('a[href]',0)->href; - $item->uri = 'http://google.com'.$t; + $item->uri = ''.$t; parse_str(parse_url($t, PHP_URL_QUERY),$parameters); if (isset($parameters['q'])) { $item->uri = $parameters['q']; } $item->title = $element->find('h3',0)->plaintext; diff --git a/bridges/WakkuwakkuBridge.php b/bridges/WakkuwakkuBridge.php deleted file mode 100644 index b6e39b3..0000000 --- a/bridges/WakkuwakkuBridge.php +++ /dev/null @@ -1,54 +0,0 @@ -returnError('Could not request WakkuWakku.', 404); - $input_json = explode('Post.register(', $html); - foreach($input_json as $element) - $data[] = preg_replace('/}\)(.*)/', '}', $element); - unset($data[0]); - - foreach($data as $datai) { - $json = json_decode($datai, TRUE); - $item = new \Item(); - $item->uri = 'http://wakku.to/post/show/'.$json['id']; - $item->postid = $json['id']; - $item->timestamp = strtotime($json['created_at']); - $item->imageUri = 'http://wakku.to/'.$json['file_url']; - $item->thumbnailUri = 'http://wakku.to/'.$json['preview_url']; - $item->title = 'WakkuWakku | '.$json['id']; - $item->content = '
Tags: '.$json['tags']; - if(isset($json['id']) and !empty($json['id'])) $this->items[] = $item; - } - } - - public function getName(){ - return 'WakkuWakku'; - } - - public function getURI(){ - return 'http://wakku.to/'; - } - - public function getCacheDuration(){ - return 1800; // 30 minutes - } -}