mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-04 18:14:44 +02:00
bridges: Replace returnError function with more specific
Replacements depend on original error code: 400: returnClientError 404: returnServerError 500: returnServerError 501: returnServerError
This commit is contained in:
parent
73a1bcf3d6
commit
74f0572d91
124 changed files with 401 additions and 400 deletions
|
@ -7,7 +7,7 @@ class FourchanBridge extends BridgeAbstract{
|
|||
$this->name = "4chan";
|
||||
$this->uri = "https://www.4chan.org/";
|
||||
$this->description = "Returns posts from the specified thread";
|
||||
$this->update = "2016-08-09";
|
||||
$this->update = '2016-08-17';
|
||||
|
||||
$this->parameters[] =
|
||||
'[
|
||||
|
@ -22,17 +22,17 @@ class FourchanBridge extends BridgeAbstract{
|
|||
public function collectData(array $param){
|
||||
|
||||
if (!isset($param['t']))
|
||||
$this->returnError('You must specify the thread URL (?t=...)', 400);
|
||||
$this->returnClientError('You must specify the thread URL (?t=...)');
|
||||
|
||||
$thread = parse_url($param['t']) or $this->returnError('This URL seems malformed, please check it.', 400);
|
||||
$thread = parse_url($param['t']) or $this->returnClientError('This URL seems malformed, please check it.');
|
||||
if($thread['host'] !== 'boards.4chan.org')
|
||||
$this->returnError('4chan thread URL only.', 400);
|
||||
$this->returnClientError('4chan thread URL only.');
|
||||
|
||||
if(strpos($thread['path'], 'thread/') === FALSE)
|
||||
$this->returnError('You must specify the thread URL.', 400);
|
||||
$this->returnClientError('You must specify the thread URL.');
|
||||
|
||||
$url = 'https://boards.4chan.org'.$thread['path'].'';
|
||||
$html = $this->file_get_html($url) or $this->returnError("Could not request 4chan, thread not found", 404);
|
||||
$html = $this->file_get_html($url) or $this->returnServerError("Could not request 4chan, thread not found");
|
||||
|
||||
foreach($html->find('div.postContainer') as $element) {
|
||||
$item = new \Item();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue