videos.php 782 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. chdir("../../");
  3. header("Content-Type: application/json");
  4. include "data/config.php";
  5. if(config::API_ENABLED === false){
  6. echo json_encode(["status" => "The server administrator disabled the API!"]);
  7. return;
  8. }
  9. include "lib/frontend.php";
  10. $frontend = new frontend();
  11. /*
  12. Captcha
  13. */
  14. include "lib/bot_protection.php";
  15. $null = null;
  16. new bot_protection($null, $null, $null, "videos", false);
  17. [$scraper, $filters] = $frontend->getscraperfilters(
  18. "videos",
  19. isset($_GET["scraper"]) ? $_GET["scraper"] : null
  20. );
  21. $get = $frontend->parsegetfilters($_GET, $filters);
  22. try{
  23. echo json_encode(
  24. $scraper->video($get),
  25. JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_IGNORE
  26. );
  27. }catch(Exception $e){
  28. echo json_encode(["status" => $e->getMessage()]);
  29. }