File size: 4,203 Bytes
fce7147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
license: mit
title: 'Still frame '
sdk: docker
emoji: πŸš€
colorFrom: green
colorTo: red
pinned: false
thumbnail: >-
  https://cdn-uploads.huggingface.co/production/uploads/683d3312c1707119d087fc4d/DDo9ikZZQM1L9k5UC1ePR.jpeg
short_description: 'Screenshot for picture '
---
title: TMDB OCR Pro API emoji: 🎬 colorFrom: blue colorTo: indigo sdk: docker app_file: app.py pinned: false
🎬 TMDB + OCR Pro API (OptiPix Engine)
Created by: Badal πŸš€
This is a high-performance, parallel-processing API designed to fetch 100% clean, text-free movie screenshots and posters. It bridges the gap between IMDb, TMDb, and the OptiPix Image Compression Engine.
✨ Key Features
 * Smart Text-Filter: Uses TMDb's language tag hack (iso_639_1 is null) to instantly filter out fan-made posters and title cards.
 * Hardcore OCR Scanner: Integrates Tesseract OCR (English, Hindi, Telugu) to aggressively scan and reject any remaining images containing text.
 * Parallel Optimization: Uses asyncio.gather to send multiple images to the OptiPix compression server simultaneously, resulting in blazing-fast response times.
 * ISP Bypass (India Ready): Generates optimized URLs via a custom CDN, bypassing Indian ISP blocks on TMDb image servers.
 * Dual URL Output: Returns both the original TMDb HD URL and the Secured OptiPix Compressed URL.
πŸ“‘ API Reference
Endpoint
POST /get-media
Request Format
Content-Type: multipart/form-data
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| title_id | string | Yes | - | The IMDb Title ID of the movie (e.g., tt3801314). |
| top_shots | integer | No | 3 | Maximum number of clean screenshots you want to fetch. |
| level | string | No | extreme | Compression level for OptiPix (none, medium, extreme). |
πŸ’» How to Make a Request
Example 1: cURL (Terminal)
curl -X POST "https://YOUR_SPACE_NAME.hf.space/get-media" \
     -H "accept: application/json" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     -d "title_id=tt3801314&top_shots=3&level=extreme"

Example 2: JavaScript (Frontend)
const formData = new FormData();
formData.append("title_id", "tt3801314");
formData.append("top_shots", 3);
formData.append("level", "extreme");

fetch("https://YOUR_SPACE_NAME.hf.space/get-media", {
  method: "POST",
  body: formData
})
.then(response => response.json())
.then(data => console.log(data));

πŸ“¦ Expected JSON Response
The API returns a clean JSON object containing both the Poster and an array of Screenshots.
{
  "title_id": "tt3801314",
  "tmdb_id": 293313,
  "requested_shots": 3,
  "total_screenshots_scanned": 15,
  "poster": {
    "original_url": "[https://image.tmdb.org/t/p/original/mxyz123.jpg](https://image.tmdb.org/t/p/original/mxyz123.jpg)",
    "processed_url": "[https://bk939448-image-optimizer-api.hf.space/optimized_poster.jpg](https://bk939448-image-optimizer-api.hf.space/optimized_poster.jpg)"
  },
  "screenshots": [
    {
      "original_url": "[https://image.tmdb.org/t/p/original/abc1.jpg](https://image.tmdb.org/t/p/original/abc1.jpg)",
      "processed_url": "[https://bk939448-image-optimizer-api.hf.space/shot1.jpg](https://bk939448-image-optimizer-api.hf.space/shot1.jpg)"
    },
    {
      "original_url": "[https://image.tmdb.org/t/p/original/abc2.jpg](https://image.tmdb.org/t/p/original/abc2.jpg)",
      "processed_url": "[https://bk939448-image-optimizer-api.hf.space/shot2.jpg](https://bk939448-image-optimizer-api.hf.space/shot2.jpg)"
    },
    {
      "original_url": "[https://image.tmdb.org/t/p/original/abc3.jpg](https://image.tmdb.org/t/p/original/abc3.jpg)",
      "processed_url": "[https://bk939448-image-optimizer-api.hf.space/shot3.jpg](https://bk939448-image-optimizer-api.hf.space/shot3.jpg)"
    }
  ]
}

Note: If OptiPix fails to compress an image, the processed_url will return as null. You can always fallback to the original_url.
βš™οΈ Deployment Requirements
If you are hosting this yourself, ensure the following setup:
 * Dockerfile: Must have tesseract-ocr, tesseract-ocr-hin, and tesseract-ocr-tel installed via apt-get.
 * Environment Variables: You MUST set your TMDb API Key in the server secrets.
   * TMDB_API_KEY = your_tmdb_api_key_here