mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 10:04:54 +02:00
bridges: use BridgeAbstract::getSimpleHTMLDOM
instead of BridgeAbstract::file_get_html Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
parent
f43bbda83e
commit
3c0d13c1bb
121 changed files with 1212 additions and 396 deletions
|
@ -26,18 +26,18 @@ class LolibooruBridge 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['p'])) {
|
||||
$page = (int)preg_replace("/[^0-9]/",'', $param['p']);
|
||||
}
|
||||
if (isset($param['t'])) {
|
||||
$tags = urlencode($param['t']);
|
||||
if (isset($param['t'])) {
|
||||
$tags = urlencode($param['t']);
|
||||
}
|
||||
$html = $this->file_get_html("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Lolibooru.');
|
||||
$html = $this->getSimpleHTMLDOM("http://lolibooru.moe/post?page=$page&tags=$tags") or $this->returnServerError('Could not request Lolibooru.');
|
||||
$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();
|
||||
|
@ -46,7 +46,7 @@ class LolibooruBridge extends BridgeAbstract{
|
|||
$item->timestamp = $json['created_at'];
|
||||
$item->imageUri = $json['file_url'];
|
||||
$item->title = 'Lolibooru | '.$json['id'];
|
||||
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||
$item->content = '<a href="' . $item->imageUri . '"><img src="' . $json['preview_url'] . '" /></a><br>Tags: '.$json['tags'];
|
||||
$this->items[] = $item;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue