Fixing, removing bridges

This commit is contained in:
Mitsukarenai 2015-01-20 19:06:51 +01:00
parent bb2c04bbf8
commit 4c48e85e12
3 changed files with 6 additions and 60 deletions

View file

@ -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 = '<a href="' . $item->uri . '"><img src="' . $item->thumbnailUri . '" /></a><br>Tags: '.$item->tags;

View file

@ -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;

View file

@ -1,54 +0,0 @@
<?php
/**
* RssBridgeWakkuWakku
* Returns images from given page
* 2014-05-25
*
* @name WakkuWakku
* @homepage http://wakku.to/
* @description Returns images from given page
* @maintainer mitsukarenai
* @use1(p="page",t="tags")
*/
class WakkuWakkuBridge extends BridgeAbstract{
public function collectData(array $param){
$page = 1;$tags='';
if (isset($param['p'])) {
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
}
if (isset($param['t'])) {
$tags = urlencode($param['t']);
}
$html = file_get_html("http://wakku.to/post?page=$page&tags=$tags") or $this->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 = '<a href="' . $item->imageUri . '"><img src="' . $item->thumbnailUri . '" /></a><br>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
}
}