This commit is contained in:
ct
2025-08-10 21:14:11 +08:00
parent 583a804073
commit 4b2d248fc3
2 changed files with 17 additions and 4 deletions

View File

@@ -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
*/

View File

@@ -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)