diff --git a/src/CrawlshotClient.php b/src/CrawlshotClient.php index a7c97d6..0a509c7 100644 --- a/src/CrawlshotClient.php +++ b/src/CrawlshotClient.php @@ -56,13 +56,11 @@ public function getShotStatus(string $uuid): array } /** - * GET /api/shot/{uuid}/download - Download screenshot file + * GET /api/shot/{uuid}.webp - Download screenshot file */ public function downloadShot(string $uuid): string { - $response = Http::when($this->token, function ($http) { - return $http->withToken($this->token); - })->get($this->baseUrl . "/api/shot/{$uuid}/download"); + $response = Http::get($this->baseUrl . "/api/shot/{$uuid}.webp"); if ($response->failed()) { throw new \Exception("Failed to download screenshot: " . $response->body()); @@ -71,6 +69,20 @@ public function downloadShot(string $uuid): string return $response->body(); } + /** + * GET /api/crawl/{uuid}.html - Download crawl HTML file + */ + public function downloadCrawl(string $uuid): string + { + $response = Http::get($this->baseUrl . "/api/crawl/{$uuid}.html"); + + if ($response->failed()) { + throw new \Exception("Failed to download crawl HTML: " . $response->body()); + } + + return $response->body(); + } + /** * GET /api/shot - List all screenshot jobs */ diff --git a/src/Facades/Crawlshot.php b/src/Facades/Crawlshot.php index 84d05d2..123051c 100644 --- a/src/Facades/Crawlshot.php +++ b/src/Facades/Crawlshot.php @@ -8,6 +8,7 @@ * @method static array createCrawl(string $url, array $options = []) * @method static array getCrawlStatus(string $uuid) * @method static array listCrawls() + * @method static string downloadCrawl(string $uuid) * @method static array createShot(string $url, array $options = []) * @method static array getShotStatus(string $uuid) * @method static string downloadShot(string $uuid)