Spaces:
Runtime error

Sharry / README.md
Sharry24's picture
Upload 8 files
d0df973 verified
|
Raw History Blame Contribute Delete
2.27 kB
---
title: CraftMovies API
emoji: 🎬
colorFrom: red
colorTo: gray
sdk: docker
pinned: false
---
# CraftMovies API β€” Hugging Face Space
FastAPI backend for CraftMovies, ready for Hugging Face Spaces Docker hosting.
## What this API does
Returns JSON for:
- Search
- Search All: search + TV seasons + episode metadata
- Browse movies
- Browse TV
- Movie detail
- TV show detail
- Episode detail
- Visible iframe `embed_url`
## Important
This API returns metadata and visible iframe embed URLs only. It does **not** bypass DRM, decode protected players, break tokens, or extract hidden third-party footage URLs.
Use returned `embed_url` in an iframe:
```html
<iframe
src="EMBED_URL_HERE"
allow="autoplay; fullscreen; picture-in-picture; encrypted-media"
referrerpolicy="no-referrer"
allowfullscreen
></iframe>
```
## Hugging Face Space setup
Create a new Space:
1. Go to Hugging Face β†’ Spaces
2. Create new Space
3. Choose **Docker**
4. Upload all files from this ZIP
5. Wait for build to finish
The API will run on port `7860`.
## Local test
```bash
pip install -r requirements.txt
python -m uvicorn main:app --host 0.0.0.0 --port 7860 --reload
```
Open:
```text
http://127.0.0.1:7860/docs
```
## Endpoints
```text
GET /
GET /health
GET /api/home
GET /api/search?q=lucifer
GET /api/search-all?q=lucifer&limit_tv=1&limit_episodes=5
GET /api/fetch-movies
GET /api/fetch-tv
GET /api/browse/movie
GET /api/browse/tv
GET /api/movie?url=/movie/5nspt-the-avengers-2012
GET /api/tv-show?url=/tv/56tj4-lucifer&limit_episodes=5
GET /api/episode?url=/tv/56tj4-lucifer/season/1/episode/3
```
## Main endpoint for app frontend
```text
GET /api/search-all?q=lucifer&limit_tv=1&limit_episodes=5
```
This does:
```text
search
β†’ detect movie/TV
β†’ expand TV show
β†’ extract seasons
β†’ fetch episode pages
β†’ return episode embed_url
```
## Environment variables
Optional variables in Space settings:
```env
CRAFTMOVIES_BASE_URL=https://streamimdb.ru
CRAFTMOVIES_TIMEOUT=15
CRAFTMOVIES_DEBUG=false
CRAFTMOVIES_CACHE_TTL_SECONDS=300
CRAFTMOVIES_CORS_ORIGINS=*
```
## CORS
Default allows all origins:
```env
CRAFTMOVIES_CORS_ORIGINS=*
```
For production, set your frontend domain:
```env
CRAFTMOVIES_CORS_ORIGINS=https://yourfrontend.com
```