Spaces:
No application file
No application file
Passed cookie path directly and deleted format argument for instagram.
Browse files- bot.py +3 -2
- bot_subprocess.py +6 -3
bot.py
CHANGED
|
@@ -31,8 +31,8 @@ MAX_FILE_SIZE_MB = 49 # Telegram's typical bot upload limit is 50MB, stay sligh
|
|
| 31 |
|
| 32 |
# --- !! IMPORTANT !! ---
|
| 33 |
# Paths to your Netscape format cookies files.
|
| 34 |
-
YOUTUBE_COOKIES_FILE
|
| 35 |
-
INSTAGRAM_COOKIES_FILE
|
| 36 |
|
| 37 |
# --- Helper Functions ---
|
| 38 |
def ensure_download_path_exists():
|
|
@@ -162,6 +162,7 @@ async def downloader(update: Update, context: ContextTypes.DEFAULT_TYPE, url: st
|
|
| 162 |
logger.warning(f"YouTube URL detected, but YouTube cookies file not found or not configured: {YOUTUBE_COOKIES_FILE}")
|
| 163 |
elif is_instagram_url(url):
|
| 164 |
if INSTAGRAM_COOKIES_FILE and os.path.exists(INSTAGRAM_COOKIES_FILE):
|
|
|
|
| 165 |
ydl_opts['cookies'] = INSTAGRAM_COOKIES_FILE
|
| 166 |
logger.info(f"Using Instagram cookies file: {INSTAGRAM_COOKIES_FILE}")
|
| 167 |
else:
|
|
|
|
| 31 |
|
| 32 |
# --- !! IMPORTANT !! ---
|
| 33 |
# Paths to your Netscape format cookies files.
|
| 34 |
+
YOUTUBE_COOKIES_FILE="cookies/youtube.txt"
|
| 35 |
+
INSTAGRAM_COOKIES_FILE="cookies/instagram.txt"
|
| 36 |
|
| 37 |
# --- Helper Functions ---
|
| 38 |
def ensure_download_path_exists():
|
|
|
|
| 162 |
logger.warning(f"YouTube URL detected, but YouTube cookies file not found or not configured: {YOUTUBE_COOKIES_FILE}")
|
| 163 |
elif is_instagram_url(url):
|
| 164 |
if INSTAGRAM_COOKIES_FILE and os.path.exists(INSTAGRAM_COOKIES_FILE):
|
| 165 |
+
del ydl_opts['format'] # TEMP FIX FOR INSTAGRAM DOWNLOAD ISSUE.
|
| 166 |
ydl_opts['cookies'] = INSTAGRAM_COOKIES_FILE
|
| 167 |
logger.info(f"Using Instagram cookies file: {INSTAGRAM_COOKIES_FILE}")
|
| 168 |
else:
|
bot_subprocess.py
CHANGED
|
@@ -32,8 +32,8 @@ MAX_FILE_SIZE_MB = 49 # Telegram's typical bot upload limit is 50MB, stay sligh
|
|
| 32 |
|
| 33 |
# --- !! IMPORTANT !! ---
|
| 34 |
# Paths to your Netscape format cookies files.
|
| 35 |
-
YOUTUBE_COOKIES_FILE =
|
| 36 |
-
INSTAGRAM_COOKIES_FILE =
|
| 37 |
|
| 38 |
# --- Helper Functions ---
|
| 39 |
def ensure_download_path_exists():
|
|
@@ -148,7 +148,10 @@ async def downloader_segment(update: Update, context: ContextTypes.DEFAULT_TYPE,
|
|
| 148 |
logger.info(f"Segment (start-onwards): recode=mp4, download_sections, force_keyframes, pp_args with -ss for FFmpegVideoConvertor.")
|
| 149 |
|
| 150 |
else: # Full video download
|
| 151 |
-
logger.info(f"Full video download requested for {url}")
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
ydl_opts_list = []
|
| 154 |
for k,v in ydl_opts.items():
|
|
|
|
| 32 |
|
| 33 |
# --- !! IMPORTANT !! ---
|
| 34 |
# Paths to your Netscape format cookies files.
|
| 35 |
+
YOUTUBE_COOKIES_FILE = "cookies/youtube.txt"
|
| 36 |
+
INSTAGRAM_COOKIES_FILE = "cookies/instagram.txt"
|
| 37 |
|
| 38 |
# --- Helper Functions ---
|
| 39 |
def ensure_download_path_exists():
|
|
|
|
| 148 |
logger.info(f"Segment (start-onwards): recode=mp4, download_sections, force_keyframes, pp_args with -ss for FFmpegVideoConvertor.")
|
| 149 |
|
| 150 |
else: # Full video download
|
| 151 |
+
logger.info(f"Full video download requested for {url}")
|
| 152 |
+
|
| 153 |
+
if "instagram" in url:
|
| 154 |
+
del ydl_opts['format'] # TEMP FIX FOR INSTAGRAM DOWNLOAD ISSUE.
|
| 155 |
|
| 156 |
ydl_opts_list = []
|
| 157 |
for k,v in ydl_opts.items():
|