Spaces:
Paused
Paused
| 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 |