Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
switch to longer cookies file
Browse files
app.py
CHANGED
|
@@ -5,16 +5,19 @@ from dotenv import load_dotenv
|
|
| 5 |
import os
|
| 6 |
import threading
|
| 7 |
import asyncio
|
|
|
|
| 8 |
import yt_dlp
|
| 9 |
|
| 10 |
# Load environment variables
|
| 11 |
load_dotenv()
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Check if cookies.txt exists
|
| 14 |
-
if not os.path.exists('cookies.txt'):
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
# Bot configuration
|
| 20 |
intents = discord.Intents.default()
|
|
@@ -29,7 +32,6 @@ class MusicBot:
|
|
| 29 |
self.ydl_opts = {
|
| 30 |
'format': 'bestaudio/best',
|
| 31 |
'cookiefile': 'cookies.txt',
|
| 32 |
-
'cookies': 'cookies.txt',
|
| 33 |
'quiet': True,
|
| 34 |
'no_warnings': True,
|
| 35 |
'extract_flat': 'in_playlist'
|
|
|
|
| 5 |
import os
|
| 6 |
import threading
|
| 7 |
import asyncio
|
| 8 |
+
from huggingface_hub import hf_hub_download
|
| 9 |
import yt_dlp
|
| 10 |
|
| 11 |
# Load environment variables
|
| 12 |
load_dotenv()
|
| 13 |
+
if os.path.exists('cookies.txt') is False:
|
| 14 |
+
hf_hub_download("not-lain/secrets", "cookies.txt", repo_type="dataset",local_dir=".")
|
| 15 |
|
| 16 |
# Check if cookies.txt exists
|
| 17 |
+
# if not os.path.exists('cookies.txt'):
|
| 18 |
+
# txt = os.getenv('COOKIES')
|
| 19 |
+
# with open('cookies.txt', 'w') as f:
|
| 20 |
+
# f.write(txt)
|
| 21 |
|
| 22 |
# Bot configuration
|
| 23 |
intents = discord.Intents.default()
|
|
|
|
| 32 |
self.ydl_opts = {
|
| 33 |
'format': 'bestaudio/best',
|
| 34 |
'cookiefile': 'cookies.txt',
|
|
|
|
| 35 |
'quiet': True,
|
| 36 |
'no_warnings': True,
|
| 37 |
'extract_flat': 'in_playlist'
|