Updated index.html and README

This commit is contained in:
2025-05-04 18:02:08 -05:00
parent 84747b2dfc
commit bf0b2fa8c7
3 changed files with 246 additions and 78 deletions

View File

@@ -2,6 +2,7 @@
"cSpell.words": [ "cSpell.words": [
"dotenv", "dotenv",
"fout", "fout",
"gluetun",
"levelname", "levelname",
"mpegts", "mpegts",
"Referer", "Referer",

114
README.md
View File

@@ -1,30 +1,62 @@
# streamlink-server # Streamlink Server
Run your m3u and mpd streams through streamlink with authentication A powerful streaming proxy server that handles various stream types through Streamlink with authentication support.
## Purpose ## Overview
Convert unstable or incompatible video streams into a format that media players can reliably play and record by processing them through streamlink. This server provides a secure way to proxy and convert video streams using Streamlink. It supports various streaming protocols and includes features for custom headers, proxy support, and authentication.
## Key Features
- Stream conversion using Streamlink
- Authentication protection for all endpoints
- Support for custom HTTP headers
- Proxy server support
- Channel configuration via JSON
- Docker and Docker Compose support
- RESTful API endpoints
- Real-time stream monitoring and recovery
- Support for MPEG-TS output format
## Requirements ## Requirements
- Python 3.11 or newer - Python 3.11 or newer
- FFmpeg - FFmpeg
- streamlink - Streamlink 6.5.0 or newer
- Python packages (install via `pip`): - Additional Python packages (installed via requirements.txt):
- FastAPI - FastAPI 0.109.0+
- uvicorn - uvicorn 0.27.0+
- python-dotenv - python-multipart 0.0.9+
- python-multipart - python-dotenv 1.0.0
- typing-extensions 4.9.0+
## Installation ## Installation
### Standard Installation
```bash ```bash
git clone https://github.com/purplescorpion1/streamlink-server.git git clone https://git.fiorinis.com/Home/streamlink-server.git
cd streamlink-server cd streamlink-server
pip install -r src/requirements.txt pip install -r src/requirements.txt
``` ```
### Docker Installation
```bash
docker-compose up -d
```
### Hugging Face Spaces Deployment
The project includes a specialized Dockerfile (`Dockerfile_HF`) optimized for deployment on Hugging Face Spaces. Once you have created the Space, you can create a Dockerfile and past the contents of `Dockerfile_HF` into it.
This version is specifically configured to run as a Space on huggingface.co, providing:
- Optimized container size
- Pre-configured environment for Spaces
- Automatic HTTPS handling
- Integration with Hugging Face's monitoring
## Configuration ## Configuration
1. Create a `.env` file in the project root: 1. Create a `.env` file in the project root:
@@ -34,7 +66,7 @@ AUTH_USERNAME=your_username
AUTH_PASSWORD=your_password AUTH_PASSWORD=your_password
``` ```
2. Configure your channels in `data/channels.json`: 2. Configure your channels in `data/channels.json`. Example:
```json ```json
{ {
@@ -42,45 +74,55 @@ AUTH_PASSWORD=your_password
{ {
"id": "1", "id": "1",
"name": "Example Channel", "name": "Example Channel",
"url": "https://example.com/stream.m3u8" "url": "https://example.com/stream",
"origin": "https://example.com",
"referer": "https://example.com/player",
"agent": "Mozilla/5.0...",
"proxy": "http://proxy:8080"
} }
] ]
} }
``` ```
## Usage ## API Endpoints
1. Start the server: ### Stream Endpoints
```bash - `GET /stream/{channel_id}` - Stream a channel by ID
python src/stream_link_server.py - `GET /stream/url` - Stream from a custom URL with query parameters
```
The server will start on port 6090 by default. ### Utility Endpoints
2. Access your streams: - `GET /utils/channels` - List all available channels
- `POST /utils/generate_url` - Generate encoded streaming URLs
- List all channels: ### Authentication
`http://localhost:6090/channels?username=xxx&password=xxx`
- Stream specific channel:
`http://localhost:6090/{channel_id}?username=xxx&password=xxx`
## Docker Support All endpoints require authentication via query parameters:
Run with Docker Compose: - `username`: Your configured username
- `password`: Your configured password
```bash ## Docker Environment Variables
docker-compose up -d
```
## Environment Variables - `AUTH_USERNAME`: Authentication username
- `AUTH_PASSWORD`: Authentication password
- `TZ`: Timezone (default: UTC)
- `AUTH_USERNAME`: Username for authentication ## Stream URL Parameters
- `AUTH_PASSWORD`: Password for authentication
- `PORT`: Server port (default: 6090) When using the `/stream/url` endpoint:
- `url`: The source stream URL (required)
- `origin`: Custom Origin header
- `referer`: Custom Referer header
- `agent`: Custom User-Agent header
- `proxy`: Proxy server URL
## Notes ## Notes
- Make sure streamlink is properly installed and available in your system PATH - All streams are converted to MPEG-TS format for maximum compatibility
- All streams require authentication with username/password - The server includes automatic stream recovery on failures
- The server provides a clean HTTP interface for your media players - Default server port is 6090
- All API endpoints require authentication
- Docker setup includes optional VPN support via gluetun

View File

@@ -3,74 +3,199 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MediaFlow Proxy</title> <title>Streamlink Server</title>
<link rel="icon" href="/logo.png" type="image/x-icon">
<style> <style>
:root {
--primary-color: #2c3e50;
--secondary-color: #3498db;
--background-color: #f8f9fa;
--card-background: #ffffff;
--text-color: #333333;
--code-background: #f0f0f0;
}
body { body {
font-family: Arial, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
line-height: 1.6; line-height: 1.6;
color: #333; color: var(--text-color);
max-width: 800px; max-width: 1200px;
margin: 0 auto; margin: 0 auto;
padding: 20px; padding: 20px;
background-color: #f9f9f9; background-color: var(--background-color);
} }
header { header {
background-color: #90aacc; background-color: var(--primary-color);
color: #fff; color: white;
padding: 10px 0; padding: 2rem;
border-radius: 8px;
margin-bottom: 2rem;
text-align: center; text-align: center;
display: flex;
flex-direction: column;
align-items: center;
} }
header img { .logo {
width: 200px; width: 150px;
height: 200px; height: auto;
vertical-align: middle; margin-bottom: 1.5rem;
border-radius: 15px; }
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
padding: 1rem;
}
.card {
background: var(--card-background);
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1, h2, h3 {
color: var(--primary-color);
} }
header h1 { header h1 {
display: inline; color: white;
margin-left: 20px;
font-size: 36px;
} }
.feature { code {
background-color: #f4f4f4; background: var(--code-background);
border-left: 4px solid #3498db; padding: 0.2em 0.4em;
padding: 10px; border-radius: 3px;
margin-bottom: 10px; font-family: 'Monaco', 'Consolas', monospace;
} }
a { pre {
color: #3498db; background: var(--code-background);
padding: 1rem;
border-radius: 8px;
overflow-x: auto;
margin: 1rem 0;
}
.endpoint {
border-left: 4px solid var(--secondary-color);
padding-left: 1rem;
margin: 1rem 0;
}
.installation-methods {
margin: 2rem 0;
}
.feature-list {
list-style-type: none;
padding: 0;
}
.feature-list li {
margin-bottom: 0.5rem;
padding-left: 1.5rem;
position: relative;
}
.feature-list li::before {
content: "•";
color: var(--secondary-color);
position: absolute;
left: 0;
} }
</style> </style>
</head> </head>
<body> <body>
<header> <header>
<img src="/logo.png" alt="MediaFlow Proxy Logo"> <img src="/logo.png" alt="Streamlink Server Logo" class="logo">
<h1>MediaFlow Proxy</h1> <h1>Streamlink Server</h1>
</header> <p>A powerful streaming proxy server that handles various stream types through Streamlink with authentication support</p>
<p>A high-performance proxy server for streaming media, supporting HTTP(S), HLS, and MPEG-DASH with real-time DRM decryption.</p> </header>
<h2>Key Features</h2> <main>
<div class="feature">Convert MPEG-DASH streams (DRM-protected and non-protected) to HLS</div> <section class="card">
<div class="feature">Support for Clear Key DRM-protected MPD DASH streams</div> <h2>Overview</h2>
<div class="feature">Handle both live and video-on-demand (VOD) DASH streams</div> <p>This server provides a secure way to proxy and convert video streams using Streamlink. It supports various streaming protocols and includes features for custom headers, proxy support, and authentication.</p>
<div class="feature">Proxy HTTP/HTTPS links with custom headers</div> </section>
<div class="feature">Proxy and modify HLS (M3U8) streams in real-time with custom headers and key URL modifications for bypassing some sneaky restrictions.</div>
<div class="feature">Protect against unauthorized access and network bandwidth abuses</div>
<h2>Getting Started</h2> <section class="container">
<p>Visit the <a href="https://github.com/mhdzumair/mediaflow-proxy">GitHub repository</a> for installation instructions and documentation.</p> <div class="card">
<h2>Key Features</h2>
<ul class="feature-list">
<li>Stream conversion using Streamlink</li>
<li>Authentication protection for all endpoints</li>
<li>Support for custom HTTP headers</li>
<li>Proxy server support</li>
<li>Channel configuration via JSON</li>
<li>Docker and Docker Compose support</li>
<li>RESTful API endpoints</li>
<li>Real-time stream monitoring and recovery</li>
<li>Support for MPEG-TS output format</li>
</ul>
</div>
<h2>Premium Hosted Service</h2> <div class="card">
<p>For a hassle-free experience, check out <a href="https://store.elfhosted.com/product/mediaflow-proxy">premium hosted service on ElfHosted</a>.</p> <h2>Requirements</h2>
<ul class="feature-list">
<li>Python 3.11 or newer</li>
<li>FFmpeg</li>
<li>Streamlink 6.5.0 or newer</li>
<li>FastAPI 0.109.0+</li>
<li>uvicorn 0.27.0+</li>
<li>python-multipart 0.0.9+</li>
<li>python-dotenv 1.0.0</li>
<li>typing-extensions 4.9.0+</li>
</ul>
</div>
</section>
<h2>API Documentation</h2> <section class="card">
<p>Explore the <a href="/docs">Swagger UI</a> for comprehensive details about the API endpoints and their usage.</p> <h2>API Endpoints</h2>
<div class="endpoint">
<h3>Stream Endpoints</h3>
<code>GET /stream/{channel_id}</code> - Stream a channel by ID<br>
<code>GET /stream/url</code> - Stream from a custom URL with query parameters
</div>
<div class="endpoint">
<h3>Utility Endpoints</h3>
<code>GET /utils/channels</code> - List all available channels<br>
<code>POST /utils/generate_url</code> - Generate encoded streaming URLs
</div>
</section>
<section class="card">
<h2>Installation Methods</h2>
<div class="installation-methods">
<h3>Standard Installation</h3>
<pre><code>git clone https://git.fiorinis.com/Home/streamlink-server.git
cd streamlink-server
pip install -r src/requirements.txt</code></pre>
<h3>Docker Installation</h3>
<pre><code>docker-compose up -d</code></pre>
<h3>Hugging Face Spaces</h3>
<p>Use the provided <code>Dockerfile_HF</code> for deployment on Hugging Face Spaces with:</p>
<ul>
<li>Optimized container size</li>
<li>Pre-configured environment for Spaces</li>
<li>Automatic HTTPS handling</li>
<li>Integration with Hugging Face's monitoring</li>
</ul>
</div>
</section>
<section class="card">
<h2>Documentation</h2>
<p>For detailed API documentation and interactive testing, visit the <a href="/docs">Swagger UI</a>.</p>
<p>For the OpenAPI specification, visit <a href="/openapi.json">OpenAPI JSON</a>.</p>
</section>
</main>
</body> </body>
</html> </html>