Skip to main content
Glama

Video Downloader MCP Server

test_download_scenarios.pyโ€ข5.03 kB
#!/usr/bin/env python3 """ Test different download scenarios to show where files go """ import os import json import sys sys.path.append('.') from server import YtDlpExtractor def test_download_scenarios(): """Test different download configurations""" print("๐ŸŽฏ Testing Download Scenarios") print("=" * 50) test_url = "https://www.facebook.com/reel/721818657509109" extractor = YtDlpExtractor() # Create test directories test_dirs = { "downloads": "/tmp/test_downloads", "organized": "/tmp/organized_videos", "user_downloads": os.path.expanduser("~/Downloads/video_test") } for name, path in test_dirs.items(): os.makedirs(path, exist_ok=True) print(f"๐Ÿ“ Created test directory: {path}") print("\n๐Ÿงช Testing different download configurations:\n") # Scenario 1: Default behavior (current directory) print("1๏ธโƒฃ SCENARIO: Default (current directory)") print(f" Command: download_video('{test_url}')") print(f" Expected location: {os.getcwd()}/[video_title].mp4") print(" โš ๏ธ Note: Not actually downloading to avoid clutter\n") # Scenario 2: Specific directory with template print("2๏ธโƒฃ SCENARIO: Downloads folder with template") template_path = f"{test_dirs['downloads']}/%(title)s.%(ext)s" print(f" Command: download_video('{test_url}', output_path='{template_path}')") print(f" Expected location: {test_dirs['downloads']}/[video_title].mp4") # Simulate this one print(" ๐Ÿ”„ Simulating this download...") result = extractor.download_video(test_url, output_path=template_path) if result.get('success'): print(" โœ… Download successful!") downloaded_files = os.listdir(test_dirs['downloads']) for file in downloaded_files: file_path = os.path.join(test_dirs['downloads'], file) size = os.path.getsize(file_path) print(f" ๐Ÿ“ Downloaded: {file} ({size:,} bytes)") else: print(f" โŒ Download failed: {result.get('error')}") print() # Scenario 3: Organized by uploader print("3๏ธโƒฃ SCENARIO: Organized by uploader") organized_path = f"{test_dirs['organized']}/%(uploader)s/%(title)s.%(ext)s" print(f" Command: download_video('{test_url}', output_path='{organized_path}')") print(f" Expected: Creates uploader folder inside {test_dirs['organized']}/") # Simulate print(" ๐Ÿ”„ Simulating organized download...") result = extractor.download_video(test_url, output_path=organized_path) if result.get('success'): print(" โœ… Download successful!") # Walk directory tree to show organization for root, dirs, files in os.walk(test_dirs['organized']): level = root.replace(test_dirs['organized'], '').count(os.sep) indent = ' ' * 4 * level print(f" ๐Ÿ“ {indent}{os.path.basename(root)}/") sub_indent = ' ' * 4 * (level + 1) for file in files: file_path = os.path.join(root, file) size = os.path.getsize(file_path) print(f" ๐Ÿ“„ {sub_indent}{file} ({size:,} bytes)") print() # Scenario 4: Fixed filename print("4๏ธโƒฃ SCENARIO: Fixed filename") fixed_path = f"{test_dirs['user_downloads']}/my_facebook_reel.mp4" print(f" Command: download_video('{test_url}', output_path='{fixed_path}')") print(f" Expected: Exact file at {fixed_path}") # Simulate print(" ๐Ÿ”„ Simulating fixed filename download...") result = extractor.download_video(test_url, output_path=fixed_path) if result.get('success'): print(" โœ… Download successful!") if os.path.exists(fixed_path): size = os.path.getsize(fixed_path) print(f" ๐Ÿ“„ File: {fixed_path} ({size:,} bytes)") print() # Show summary print("๐Ÿ“Š SUMMARY OF DOWNLOAD LOCATIONS:") print("=" * 40) all_test_dirs = [test_dirs['downloads'], test_dirs['organized'], test_dirs['user_downloads']] total_files = 0 total_size = 0 for test_dir in all_test_dirs: if os.path.exists(test_dir): print(f"\n๐Ÿ“ {test_dir}:") for root, dirs, files in os.walk(test_dir): for file in files: file_path = os.path.join(root, file) size = os.path.getsize(file_path) rel_path = os.path.relpath(file_path, test_dir) print(f" ๐Ÿ“„ {rel_path} ({size:,} bytes)") total_files += 1 total_size += size print(f"\n๐ŸŽ‰ Total: {total_files} files, {total_size:,} bytes downloaded") # Cleanup option print(f"\n๐Ÿงน To cleanup test files, run:") for test_dir in all_test_dirs: if os.path.exists(test_dir): print(f" rm -rf {test_dir}") if __name__ == "__main__": test_download_scenarios()

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chazmaniandinkle/video-downloader-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server