diff --git a/app/Jobs/ThePornDBVideoScraper.php b/app/Jobs/ThePornDBVideoScraper.php index 4fdcde4d0..0aa1513b1 100644 --- a/app/Jobs/ThePornDBVideoScraper.php +++ b/app/Jobs/ThePornDBVideoScraper.php @@ -32,7 +32,19 @@ class ThePornDBVideoScraper implements ShouldQueue public function handle(): void { $endpoint = sprintf('https://api.theporndb.net/%s/%s?add_to_collection=false', $this->type, $this->id); - $response = Http::get($endpoint); + $apiKey = config('api-keys.theporndb'); + $headers = [ + 'Authorization' => 'Bearer ' . $apiKey, + ]; + Log::debug('ThePornDBVideoScraper: Request', [ + 'endpoint' => $endpoint, + 'headers' => $headers, + ]); + $response = Http::withHeaders($headers)->get($endpoint); + Log::debug('ThePornDBVideoScraper: Response', [ + 'status' => $response->status(), + 'body' => $response->body(), + ]); if ($response->successful()) { $data = $response->json(); @@ -64,10 +76,10 @@ class ThePornDBVideoScraper implements ShouldQueue 'url' => $main['url'] ?? null, 'image' => $main['image'] ?? null, 'description' => $main['description'] ?? null, - 'performers' => $performers, - 'site' => $site, - 'tags' => $tags, - 'raw' => $data, + 'performers' => json_encode($performers), + 'site' => json_encode($site), + 'tags' => json_encode($tags), + 'raw' => json_encode($data), ]; if ($this->type === 'scenes') { \App\Models\ThePornDbSceneMeta::updateOrCreate([ diff --git a/config/api-keys.php b/config/api-keys.php index ef0e23b22..5be2cbd90 100644 --- a/config/api-keys.php +++ b/config/api-keys.php @@ -24,4 +24,8 @@ return [ */ 'tmdb' => env('TMDB_API_KEY', ''), + + 'theporndb' => env('THEPORNDB_API_KEY', ''), + 'fansdb' => env('FANSDB_KEY', ''), + 'theporndb' => env('THEPORNDB_KEY', ''), ];