Spaces:
Paused
Paused
Update test.py
Browse files
test.py
CHANGED
|
@@ -5,15 +5,13 @@ import os
|
|
| 5 |
|
| 6 |
app = FastAPI()
|
| 7 |
m3u8_url = "https://hfs302.serversicuro.cc/hls/,dnzpfec63dg4a3gyvapx72rcyqjwtaix6g6gsfexbdzt3uusvijhskjgwl5a,.urlset/master.m3u8"
|
| 8 |
-
m3u8_file_path = "
|
| 9 |
|
| 10 |
def fetch_and_save_m3u8(url, file_path):
|
| 11 |
"""Fetch the M3U8 file from the URL and save it to the local file system."""
|
| 12 |
response = requests.get(url)
|
| 13 |
response.raise_for_status() # Raise an error for bad responses
|
| 14 |
|
| 15 |
-
# Create directory if it doesn't exist
|
| 16 |
-
os.makedirs(os.path.dirname(file_path), exist_ok=True)
|
| 17 |
|
| 18 |
with open(file_path, 'w') as f:
|
| 19 |
f.write(response.text)
|
|
|
|
| 5 |
|
| 6 |
app = FastAPI()
|
| 7 |
m3u8_url = "https://hfs302.serversicuro.cc/hls/,dnzpfec63dg4a3gyvapx72rcyqjwtaix6g6gsfexbdzt3uusvijhskjgwl5a,.urlset/master.m3u8"
|
| 8 |
+
m3u8_file_path = "myvideo.m3u8"
|
| 9 |
|
| 10 |
def fetch_and_save_m3u8(url, file_path):
|
| 11 |
"""Fetch the M3U8 file from the URL and save it to the local file system."""
|
| 12 |
response = requests.get(url)
|
| 13 |
response.raise_for_status() # Raise an error for bad responses
|
| 14 |
|
|
|
|
|
|
|
| 15 |
|
| 16 |
with open(file_path, 'w') as f:
|
| 17 |
f.write(response.text)
|