diff options
Diffstat (limited to 'api/v1')
-rw-r--r-- | api/v1/images.php | 25 | ||||
-rw-r--r-- | api/v1/index.php | 10 | ||||
-rw-r--r-- | api/v1/news.php | 25 | ||||
-rw-r--r-- | api/v1/videos.php | 25 | ||||
-rw-r--r-- | api/v1/web.php | 30 |
5 files changed, 115 insertions, 0 deletions
diff --git a/api/v1/images.php b/api/v1/images.php new file mode 100644 index 0000000..e05ba26 --- /dev/null +++ b/api/v1/images.php @@ -0,0 +1,25 @@ +<?php + +header("Content-Type: application/json"); + +chdir("../../"); + +include "lib/frontend.php"; +$frontend = new frontend(); + +[$scraper, $filters] = $frontend->getscraperfilters( + "images", + isset($_GET["scraper"]) ? $_GET["scraper"] : null +); + +$get = $frontend->parsegetfilters($_GET, $filters); + +try{ + echo json_encode( + $scraper->image($get) + ); + +}catch(Exception $e){ + + echo json_encode(["status" => $e->getMessage()]); +} diff --git a/api/v1/index.php b/api/v1/index.php new file mode 100644 index 0000000..dae86ab --- /dev/null +++ b/api/v1/index.php @@ -0,0 +1,10 @@ +<?php + +header("Content-Type: application/json"); +http_response_code(404); + +echo json_encode( + [ + "status" => "Unknown endpoint" + ] +); diff --git a/api/v1/news.php b/api/v1/news.php new file mode 100644 index 0000000..7e24247 --- /dev/null +++ b/api/v1/news.php @@ -0,0 +1,25 @@ +<?php + +header("Content-Type: application/json"); + +chdir("../../"); + +include "lib/frontend.php"; +$frontend = new frontend(); + +[$scraper, $filters] = $frontend->getscraperfilters( + "news", + isset($_GET["scraper"]) ? $_GET["scraper"] : null +); + +$get = $frontend->parsegetfilters($_GET, $filters); + +try{ + echo json_encode( + $scraper->news($get) + ); + +}catch(Exception $e){ + + echo json_encode(["status" => $e->getMessage()]); +} diff --git a/api/v1/videos.php b/api/v1/videos.php new file mode 100644 index 0000000..60c105a --- /dev/null +++ b/api/v1/videos.php @@ -0,0 +1,25 @@ +<?php + +header("Content-Type: application/json"); + +chdir("../../"); + +include "lib/frontend.php"; +$frontend = new frontend(); + +[$scraper, $filters] = $frontend->getscraperfilters( + "videos", + isset($_GET["scraper"]) ? $_GET["scraper"] : null +); + +$get = $frontend->parsegetfilters($_GET, $filters); + +try{ + echo json_encode( + $scraper->video($get) + ); + +}catch(Exception $e){ + + echo json_encode(["status" => $e->getMessage()]); +} diff --git a/api/v1/web.php b/api/v1/web.php new file mode 100644 index 0000000..7895183 --- /dev/null +++ b/api/v1/web.php @@ -0,0 +1,30 @@ +<?php + +header("Content-Type: application/json"); + +chdir("../../"); + +include "lib/frontend.php"; +$frontend = new frontend(); + +[$scraper, $filters] = $frontend->getscraperfilters( + "web", + isset($_GET["scraper"]) ? $_GET["scraper"] : null +); + +$get = $frontend->parsegetfilters($_GET, $filters); + +if(!isset($_GET["extendedsearch"])){ + + $get["extendedsearch"] = "no"; +} + +try{ + echo json_encode( + $scraper->web($get) + ); + +}catch(Exception $e){ + + echo json_encode(["status" => $e->getMessage()]); +} |