encoded url
Build and Push Docker Images / build-and-push (push) Successful in 18s

This commit is contained in:
2025-04-16 21:37:04 +02:00
parent 122ddf7f56
commit 18e9109297
+7 -2
View File
@@ -2,12 +2,15 @@ import os
import requests
import schedule
import time
import base64
from datetime import datetime
from flask import Flask, Response
from threading import Thread
# Configuration
SOURCE_URL = os.environ.get('SOURCE_URL', 'http://example.com/source.m3u8')
ENCODED_SOURCE_URL = os.environ.get('ENCODED_SOURCE_URL', '')
# Fallback to a direct URL if no encoded URL is provided
SOURCE_URL = base64.b64decode(ENCODED_SOURCE_URL).decode('utf-8') if ENCODED_SOURCE_URL else os.environ.get('SOURCE_URL', 'http://example.com/source.m3u8')
PORT = int(os.environ.get('PORT', 8000))
M3U8_DIR = '/m3u8'
LOCAL_FILE_PATH = os.path.join(M3U8_DIR, 'playlist.m3u8')
@@ -20,7 +23,7 @@ def download_m3u8():
# Ensure the directory exists
os.makedirs(M3U8_DIR, exist_ok=True)
print(f"{datetime.now()} - Downloading M3U8 from {SOURCE_URL}")
print(f"{datetime.now()} - Downloading M3U8 from source")
response = requests.get(SOURCE_URL, timeout=30)
if response.status_code == 200:
@@ -63,6 +66,8 @@ def schedule_downloads():
def main():
"""Main function to start the application"""
print(f"{datetime.now()} - Starting IPTV Filter service")
# Initial download
if not download_m3u8():
print("Initial download failed. Retrying in 30 seconds...")