Spaces:
Configuration error
Configuration error
Update app.py
Browse files137 unmodified lines1381391401411421431441451461471481491501511523 unmodified lines156157158159160161162163164165166167137 unmodified linesstream_url = url_or_pathif "youtube.com" in url_or_path or "youtu.be" in url_or_path:ydl_opts = {'format': 'best','quiet': True,'no_warnings': True,'noplaylist': True,'extractor_args': {'youtube': {'player_client': ['ios', 'android', 'tv']}}}if os.path.exists(COOKIES_PATH):ydl_opts['cookiefile'] = COOKIES_PATH3 unmodified linesprint(f"๐ ืื ืกื ืืืืฅ ืืืืื ื-YouTube: {url_or_path}")with yt_dlp.YoutubeDL(ydl_opts) as ydl:info = ydl.extract_info(url_or_path, download=False)stream_url = info.get('url') or info.get('manifest_url')if not stream_url and 'formats' in info:for f in info['formats']:if f.get('url'):stream_url = f['url']breakprint("โ ืงืืฉืืจ ืืืืื ืืืืฅ ืืืฆืืื!")except Exception as e:print(f"โ ืฉืืืื ืืืืืืฅ YouTube: {e}")137 unmodified lines1381391401411421431441451461473 unmodified lines151152153154155156157158159160161162163164137 unmodified linesstream_url = url_or_pathif "youtube.com" in url_or_path or "youtu.be" in url_or_path:ydl_opts = {'format': 'bestvideo*+bestaudio/best','quiet': True,'no_warnings': True,'noplaylist': True,}if os.path.exists(COOKIES_PATH):ydl_opts['cookiefile'] = COOKIES_PATH3 unmodified linesprint(f"๐ ืื ืกื ืืืืฅ ืืืืื ื-YouTube: {url_or_path}")with yt_dlp.YoutubeDL(ydl_opts) as ydl:info = ydl.extract_info(url_or_path, download=False)stream_url = info.get('url') or info.get('manifest_url')if not stream_url and 'formats' in info and len(info['formats']) > 0:for fmt in reversed(info['formats']):if fmt.get('url'):stream_url = fmt['url']breakprint("โ ืงืืฉืืจ ืืืืื ืืืืฅ ืืืฆืืื!")except Exception as e:print(f"โ ืฉืืืื ืืืืืืฅ YouTube: {e}")
app.py+7-10