Update
This commit is contained in:
@@ -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
|
public function downloadShot(string $uuid): string
|
||||||
{
|
{
|
||||||
$response = Http::when($this->token, function ($http) {
|
$response = Http::get($this->baseUrl . "/api/shot/{$uuid}.webp");
|
||||||
return $http->withToken($this->token);
|
|
||||||
})->get($this->baseUrl . "/api/shot/{$uuid}/download");
|
|
||||||
|
|
||||||
if ($response->failed()) {
|
if ($response->failed()) {
|
||||||
throw new \Exception("Failed to download screenshot: " . $response->body());
|
throw new \Exception("Failed to download screenshot: " . $response->body());
|
||||||
@@ -71,6 +69,20 @@ public function downloadShot(string $uuid): string
|
|||||||
return $response->body();
|
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
|
* GET /api/shot - List all screenshot jobs
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
* @method static array createCrawl(string $url, array $options = [])
|
* @method static array createCrawl(string $url, array $options = [])
|
||||||
* @method static array getCrawlStatus(string $uuid)
|
* @method static array getCrawlStatus(string $uuid)
|
||||||
* @method static array listCrawls()
|
* @method static array listCrawls()
|
||||||
|
* @method static string downloadCrawl(string $uuid)
|
||||||
* @method static array createShot(string $url, array $options = [])
|
* @method static array createShot(string $url, array $options = [])
|
||||||
* @method static array getShotStatus(string $uuid)
|
* @method static array getShotStatus(string $uuid)
|
||||||
* @method static string downloadShot(string $uuid)
|
* @method static string downloadShot(string $uuid)
|
||||||
|
|||||||
Reference in New Issue
Block a user