Metadata for ThePornDB scenes is now saved

This commit is contained in:
BillyOutlast
2025-08-31 22:10:43 -04:00
parent 5895bf9b8a
commit 2f047ab27e
2 changed files with 21 additions and 5 deletions

View File

@@ -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([

View File

@@ -24,4 +24,8 @@ return [
*/
'tmdb' => env('TMDB_API_KEY', ''),
'theporndb' => env('THEPORNDB_API_KEY', ''),
'fansdb' => env('FANSDB_KEY', ''),
'theporndb' => env('THEPORNDB_KEY', ''),
];