Major Features: - ✅ Complete TPDB scraper implementation with real API calls - ✅ Auto-fetch on cache miss: search commands now automatically import from TPDB when not found locally - ✅ Comprehensive documentation (5 markdown files for Bookstack) - ✅ Import commands for performers, studios, and scenes - ✅ Fixed JSON type mismatches (aliases array, studio numeric IDs) Changes: 1. TPDB Scraper (internal/scraper/tpdb/): - types.go: Full API response structures with correct types - PerformerResponse.Aliases: string → []string (TPDB returns array) - StudioResponse.ID: string → int (TPDB returns numeric IDs) - SiteInfo.ID: string → int (scenes reference studios by number) - mapper.go: Maps TPDB responses to internal models - Converts aliases array to comma-separated string - Converts numeric studio IDs to strings using strconv.Itoa() - scraper.go: Real HTTP client with Bearer token auth - SearchPerformers, SearchStudios, SearchScenes implemented - GetPerformerByID, GetStudioByID, GetSceneByID implemented 2. CLI Auto-Fetch (cmd/goondex/main.go): - performer-search: Auto-fetches from TPDB if local DB empty - studio-search: Auto-fetches from TPDB if local DB empty - scene-search: Auto-fetches basic metadata (no relationships) - Graceful handling of missing TPDB_API_KEY - Import → search again to get local IDs 3. Documentation (docs/): - INDEX.md: Documentation overview and navigation - ARCHITECTURE.md: System design, data flow, component diagrams - DATABASE_SCHEMA.md: Complete schema with relationships and indexes - CLI_REFERENCE.md: All commands with examples - TPDB_INTEGRATION.md: API guide, data mapping, best practices 4. Fixes: - .gitignore: Fixed pattern to allow cmd/goondex/* and cmd/goondexd/* - README: Updated to reflect TPDB integration and auto-fetch Testing: - ✅ performer-search "Riley Reid" - auto-fetched 2 performers, cached - ✅ studio-search "Brazzers" - auto-fetched 12 studios, cached - ✅ Aliases now display correctly as comma-separated list - ✅ Studio IDs properly converted from numeric to string API Integration: - Base URL: https://api.theporndb.net - Authentication: Bearer token via TPDB_API_KEY env var - Endpoints: /performers, /sites, /scenes - Rate limiting handled with warnings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
8.2 KiB
ThePornDB Integration Guide
Overview
Goondex integrates with ThePornDB (TPDB) to fetch high-quality metadata for performers, studios, and scenes. TPDB is a community-driven database similar to IMDB but for adult content.
Prerequisites
1. TPDB Account
- Register at https://theporndb.net/register
- Verify your email
- Log in to your account
2. API Token
- Navigate to https://theporndb.net/user/api-tokens
- Click "Create New Token"
- Give it a name (e.g., "Goondex")
- Copy the generated token
- Save it securely - it won't be shown again
3. Set Environment Variable
# Linux/macOS (add to ~/.bashrc or ~/.zshrc for persistence)
export TPDB_API_KEY="your-api-key-here"
# Windows (PowerShell)
$env:TPDB_API_KEY="your-api-key-here"
# Windows (CMD)
set TPDB_API_KEY=your-api-key-here
API Endpoints
Goondex uses the following TPDB API endpoints:
| Endpoint | Method | Purpose |
|---|---|---|
/performers |
GET | Search for performers |
/performers/{id} |
GET | Get performer by ID |
/sites |
GET | Search for studios/sites |
/sites/{id} |
GET | Get studio by ID |
/scenes |
GET | Search for scenes |
/scenes/{id} |
GET | Get scene by ID |
Base URL: https://api.theporndb.net
Authentication: Bearer token in Authorization header
Data Mapping
Performer Fields
| TPDB Field | Goondex Field | Notes |
|---|---|---|
id |
source_id |
TPDB ID stored as source reference |
name |
name |
Primary name |
aliases |
aliases |
Comma-separated alternative names |
nationality |
nationality + country |
Both fields populated |
gender |
gender |
male/female/trans/other |
image |
image_url |
Poster image URL |
bio |
bio |
Biography text |
Additional TPDB fields (available but not currently stored):
birthday,astrology,birthplaceethnicity,eye_color,hair_colorheight,weight,measurementstattoo_description,piercing_descriptionboob_job,active
Studio Fields
| TPDB Field | Goondex Field | Notes |
|---|---|---|
id |
source_id |
TPDB ID |
name |
name |
Studio/site name |
description |
description |
About the studio |
logo |
image_url |
Logo image URL |
parent.id |
parent_id |
Parent network ID (not yet implemented) |
url |
- | Currently stored in description |
Scene Fields
| TPDB Field | Goondex Field | Notes |
|---|---|---|
id |
source_id |
TPDB ID |
uuid |
- | Not stored |
title |
title |
Scene title |
description |
description |
Scene synopsis |
url |
url |
Scene URL |
date |
date |
Release date (ISO 8601) |
image |
image_url |
Cover image URL |
director |
director |
Director name |
code |
code |
DVD code or scene identifier |
site.id |
studio_id |
References studios table |
performers[] |
Scene-performer relationship | Many-to-many |
tags[] |
Scene-tag relationship | Many-to-many |
Additional TPDB fields (available but not currently stored):
poster,duration
Usage Examples
Import a Performer
# Search and import Riley Reid
export TPDB_API_KEY="your-key"
goondex import performer "Riley Reid"
What happens:
- Goondex queries TPDB API:
GET /performers?q=Riley+Reid - TPDB returns matching performers (usually 1 exact match)
- Goondex maps TPDB fields to internal model
- Data is inserted into local SQLite database
- Local ID is assigned and reported
Import a Studio
# Import Brazzers
goondex import studio "Brazzers"
What happens:
- Query:
GET /sites?q=Brazzers - TPDB returns matching sites
- Studios are created in local database
Import a Scene
# Import a scene
goondex import scene "Big Wet Butts 24"
What happens:
- Query:
GET /scenes?q=Big+Wet+Butts+24 - TPDB returns matching scenes with embedded performers, studio, and tags
- Studio is imported/updated first
- Scene is created with reference to studio
- Performers are imported/updated
- Tags are imported/updated
- Relationships are created in junction tables
API Rate Limiting
TPDB implements rate limiting to prevent abuse.
Current Limits (as of 2024)
- Requests per minute: ~60
- Requests per hour: ~1000
Best Practices
- Batch imports: Import multiple items at once instead of one-by-one
- Cache locally: Don't re-import already imported items
- Error handling: Implement exponential backoff on 429 errors
Handling Rate Limits
If you receive a 429 Too Many Requests response:
# Wait 60 seconds
sleep 60
# Retry the command
goondex import performer "Riley Reid"
Response Format
Standard Response Wrapper
{
"data": { ... }, // Single object or array
"meta": { // Optional pagination
"current_page": 1,
"from": 1,
"last_page": 5,
"per_page": 25,
"to": 25,
"total": 100
}
}
Performer Response Example
{
"data": {
"id": "12345",
"name": "Riley Reid",
"slug": "riley-reid",
"gender": "female",
"aliases": "Paige Riley",
"nationality": "US",
"image": "https://cdn.theporndb.net/performers/riley-reid.jpg",
"bio": "Riley Reid is an American adult film actress..."
}
}
Scene Response Example
{
"data": {
"id": "54321",
"uuid": "abc-def-123",
"title": "Big Wet Butts 24",
"date": "2024-01-15",
"description": "Riley Reid stars in...",
"code": "BWB-024",
"image": "https://cdn.theporndb.net/scenes/bwb-024.jpg",
"site": {
"id": "100",
"name": "Brazzers",
"url": "https://brazzers.com"
},
"performers": [
{
"id": "12345",
"name": "Riley Reid",
"gender": "female"
}
],
"tags": [
{
"id": "1",
"name": "Anal",
"slug": "anal"
}
]
}
}
Error Handling
Common HTTP Status Codes
| Code | Meaning | Solution |
|---|---|---|
| 200 | Success | No action needed |
| 401 | Unauthorized | Check API key |
| 404 | Not Found | Item doesn't exist in TPDB |
| 429 | Too Many Requests | Wait and retry |
| 500 | Server Error | TPDB issue, wait and retry |
Goondex Error Messages
# Missing API key
Error: TPDB_API_KEY environment variable is not set
# API error
Error: failed to search TPDB: API returned status 401
# No results
No performers found on TPDB
Advanced Usage
Searching by ID
While Goondex doesn't currently expose this via CLI, you can fetch by TPDB ID programmatically:
import "git.leaktechnologies.dev/stu/Goondex/internal/scraper/tpdb"
scraper := tpdb.NewScraper("https://api.theporndb.net", apiKey)
performer, err := scraper.GetPerformerByID(ctx, "12345")
Pagination
TPDB returns paginated results. Goondex currently fetches only the first page (default 25 results). Future versions will support pagination.
Data Quality
TPDB Strengths
- ✅ High-quality, curated performer data
- ✅ Comprehensive scene metadata
- ✅ Studio/network relationships
- ✅ Active community maintenance
- ✅ Regular updates
Known Limitations
- ⚠️ Not all performers have complete bio data
- ⚠️ Some older scenes may have limited metadata
- ⚠️ Parent studio relationships not always populated
- ⚠️ Image URLs may expire or change
Future Enhancements
v0.2.x
- Incremental updates: Re-import to update changed data
- Image caching: Download and cache images locally
- Pagination support: Fetch all pages of results
v0.3.x
- Scheduled syncing: Automatic daily/weekly updates
- Duplicate detection: Merge duplicate entries
- Conflict resolution: Handle data conflicts intelligently
v0.4.x
- Multi-source priority: Combine TPDB with other sources
- Manual overrides: User-edited fields protected from updates
API Documentation
Official TPDB API documentation:
Support
For TPDB-related issues:
- TPDB Discord: https://discord.gg/theporndb
- TPDB GitHub: https://github.com/ThePornDatabase
For Goondex integration issues:
- Goondex Issues: https://git.leaktechnologies.dev/stu/Goondex/issues