IL10N = $IL10N; $this->main = $main; $this->search = $search; $this->ytdl = $ytdl; parent::__construct($appName, $request); } /** * @CORS * @NoAdminRequired * @NoCSRFRequired */ public function download(string $url, string $type = "aria2", array $options = []): JSONResponse { if ($type == "aria2") { return $this->main->Download($url); } else if ($type == "ytdl") { $extension = $options["extension"] ?? "mp4"; return $this->ytdl->Download($url, $extension); } else if ($type == "bt") { return $this->main->Upload(); } return new JSONResponse(["error" => "Invalid download type"]); } /** * @CORS * @NoAdminRequired * @NoCSRFRequired */ public function search(string $keyword, string $site = "TPB"): JSONResponse { return $this->search->execute($keyword, $site); } }