await update.message.reply_text(f"📤 Sending files from: playlist_title")
async def download_playlist(update: Update, context: ContextTypes.DEFAULT_TYPE, mode='video'): url = context.user_data.get('playlist_url') if not url: await update.message.reply_text("❌ Send a playlist link first.") return telegram bot download youtube playlist
except Exception as e: await update.message.reply_text(f"❌ Error: str(e)") async def video(update: Update, context: ContextTypes.DEFAULT_TYPE): await download_playlist(update, context, 'video') await update
async def playlist_link(update: Update, context: ContextTypes.DEFAULT_TYPE): context.user_data['playlist_url'] = update.message.text await update.message.reply_text("✅ Playlist received. Now use /video or /audio") 'video') async def playlist_link(update: Update
async def audio(update: Update, context: ContextTypes.DEFAULT_TYPE): await download_playlist(update, context, 'audio')
def progress_hook(d): if d['status'] == 'downloading': print(f"Downloading: d.get('_percent_str', '')")
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text( "🎬 Send me a YouTube playlist link.\n" "Then choose:\n/video – Download as MP4\n/audio – Download as MP3" )