### Example Interaction: Choose Platform and Paste URL Source: https://nayandas69.github.io/Social-Media-Downloader/usage?q= Example interaction showing the main menu and prompts for choosing a platform and entering a video URL. ```text Welcome to Social Media Downloader! ──────────────────────────────────────────────────────────── 1. Download YouTube/TikTok... etc. 2. Download Instagram 3. Check for updates 4. Help 5. Exit Enter your choice: 1 Enter video URL: https://www.youtube.com/watch?v=EXAMPLE_ID ``` -------------------------------- ### Install with development tools Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Install the package with extra development dependencies like pytest, flake8, and black. ```bash pip install 'social-media-downloader[dev]' ``` -------------------------------- ### Install and Run .deb Package (Ubuntu/Debian) Source: https://nayandas69.github.io/Social-Media-Downloader/usage?q= Installs the .deb package globally and runs it with the smd command. Replace VERSION with the actual version number you downloaded. ```bash sudo dpkg -i social-media-downloader_VERSION_amd64.deb smd ``` -------------------------------- ### Install social-media-downloader from PyPI Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Install the package using pip. Requires Python 3.10+. ```bash pip install social-media-downloader ``` -------------------------------- ### Install via pip Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Installs the tool using the Python package manager. ```bash pip install social-media-downloader ``` -------------------------------- ### Example config.json for MP3 downloads Source: https://nayandas69.github.io/Social-Media-Downloader/config-info?q= Example configuration to auto-download MP3s to a Downloads folder. Note that the download_directory folder must already exist; the tool won't create nested directories. ```json { "default_format": "mp3", "download_directory": "C:/Users/YourName/Downloads", "history_file": "download_history.csv", "mp3_quality": "320" } ``` -------------------------------- ### Install and run .tar.gz binary on Linux Source: https://nayandas69.github.io/Social-Media-Downloader/installation?q= Extracts the .tar.gz binary, makes it executable, and runs it. Use this for non-Debian Linux distributions or portable installs. ```bash tar -xvf smd-linux.tar.gz chmod +x smd ./smd ``` -------------------------------- ### Set up Python environment on Linux Source: https://nayandas69.github.io/Social-Media-Downloader/installation?q= Creates a virtual environment, activates it, and installs dependencies on Linux. Requires Python 3.10+. ```bash python3 -m venv venv source venv/bin/activate pip3 install -r requirements.txt ``` -------------------------------- ### Verify FFmpeg installation Source: https://nayandas69.github.io/Social-Media-Downloader/installation?q= Verifies that FFmpeg is installed and accessible. If version details are shown, FFmpeg is ready. ```bash ffmpeg -version ``` -------------------------------- ### Set up Python environment on Windows Source: https://nayandas69.github.io/Social-Media-Downloader/installation?q= Creates a virtual environment, activates it, and installs dependencies on Windows. Requires Python 3.10+. ```bash python -m venv venv venv\Scripts\activate pip install -r requirements.txt ``` -------------------------------- ### Install .deb package on Linux Source: https://nayandas69.github.io/Social-Media-Downloader/installation?q= Installs the .deb package on Debian/Ubuntu-based distributions. The second command fixes any dependency issues. ```bash sudo dpkg -i social-media-downloader_VERSION_amd64.deb sudo apt-get install -f ``` -------------------------------- ### Run the smd CLI tool Source: https://nayandas69.github.io/Social-Media-Downloader/changelog Shows the two equivalent CLI commands to invoke the tool after installation. Both commands run the same main function from smd.downloader. ```bash smd # or social-media-downloader ``` -------------------------------- ### Install FFmpeg on Linux Source: https://nayandas69.github.io/Social-Media-Downloader/installation?q= Installs FFmpeg on Debian/Ubuntu-based Linux distributions. FFmpeg is required for the downloader to work. ```bash sudo apt update sudo apt install ffmpeg ``` -------------------------------- ### Install PyInstaller with pip3 Source: https://nayandas69.github.io/Social-Media-Downloader/build?q= Install PyInstaller, a tool that converts Python scripts into standalone executables, requiring no Python on the end user's system. ```bash pip3 install pyinstaller ``` -------------------------------- ### Configure pyproject.toml entry points for smd CLI Source: https://nayandas69.github.io/Social-Media-Downloader/changelog Defines the command-line entry points for the package, mapping the commands 'smd' and 'social-media-downloader' to the main function in smd.downloader. This configuration is required for the CLI scripts to work when installed via PyPI. ```toml [project.scripts] smd = "smd.downloader:main" social-media-downloader = "smd.downloader:main" ``` -------------------------------- ### Batch download from file Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Example usage of batch_download_from_file. The file should contain one Instagram post URL per line. ```python from smd import batch_download_from_file batch_download_from_file("batch_links.txt") ``` -------------------------------- ### Download a YouTube video Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Example usage of download_youtube_or_tiktok_video to download a video from a YouTube URL. ```python from smd import download_youtube_or_tiktok_video video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" download_youtube_or_tiktok_video(video_url) ``` -------------------------------- ### Update the tool Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Updates the tool to the latest version if installed via pip. ```bash pip install --upgrade social-media-downloader ``` -------------------------------- ### Uninstall the tool Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Removes the tool if installed via pip. ```bash pip uninstall social-media-downloader ``` -------------------------------- ### Download an Instagram post Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Example usage of download_instagram_post to download a single Instagram post. ```python from smd import download_instagram_post post_url = "https://www.instagram.com/p/CxA-Example/" download_instagram_post(post_url) ``` -------------------------------- ### Run the tool Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Launches the tool with the default command. ```bash social-media-downloader ``` -------------------------------- ### Build Windows version with custom icon Source: https://nayandas69.github.io/Social-Media-Downloader/build?q= Add a custom .ico file to the executable for a polished look. Ensure the icon file is in .ico format; convert .png if needed. After build, the .exe is in the dist/ folder. ```bash pyinstaller --onefile --icon=assets/logo.ico smd/downloader.py ``` -------------------------------- ### Run SMD CLI with 'social-media-downloader' command Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Alternative command to launch the interactive menu. ```bash social-media-downloader ``` -------------------------------- ### Run the tool with short command Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Launches the tool using the short command available from version 1.1.4+. ```bash smd ``` -------------------------------- ### Run Binary (Other Linux) Source: https://nayandas69.github.io/Social-Media-Downloader/usage?q= Makes the binary executable and runs it. Ensure you extracted the .tar.gz binary from Releases first. ```bash chmod +x smd ./smd ``` -------------------------------- ### Sample Output: Video Details and Formats Source: https://nayandas69.github.io/Social-Media-Downloader/usage?q= Sample output showing extraction progress, video details, and available formats. The tool then prompts you to choose a format and begins downloading. ```text [youtube] Extracting URL... [youtube] Downloading webpage... ... Video Details: Title: Social-Media-Downloader Uploader: nayandas69 Upload Date: Dec 1, 2024 Available formats: ╒══════╤═══════╤══════════════╤═══════╤═══════════╤═══════════════╤═══════════╤═══════════════╕ │ ID │ EXT │ RESOLUTION │ FPS │ SIZE │ VCODEC │ ACODEC │ NOTE │ ├──────┼───────┼──────────────┼───────┼───────────┼───────────────┼───────────┼───────────────┤ │ 136 │ mp4 │ 1280x720 │ 30 │ 56.82 MB │ avc1.4d401f │ none │ 720p │ │ 251 │ webm │ audio │ │ 0.48 MB │ none │ opus │ medium │ │ 299 │ mp4 │ 1920x1080 │ 60 │ 114.83 MB │ avc1.64002a │ none │ 1080p60 │ ╘══════╧═══════╧══════════════╧═══════╧═══════════╧═══════════════╧═══════════╧═══════════════╛ ``` -------------------------------- ### Make Linux binary executable and run it Source: https://nayandas69.github.io/Social-Media-Downloader/build?q= After building on Linux, change permissions on the output binary and run it. Produces a portable binary that runs on any compatible Linux system. ```bash chmod +x dist/downloader ./dist/downloader ``` -------------------------------- ### Default config.json Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Shows the default configuration file created on first run. ```json { "default_format": "show_all", "download_directory": "media", "history_file": "download_history.csv", "mp3_quality": "192" } ``` -------------------------------- ### Build Linux executable with PyInstaller Source: https://nayandas69.github.io/Social-Media-Downloader/build Build a one-file executable for Linux. After building, make the binary executable and run it. ```bash pyinstaller --onefile smd/downloader.py ``` ```bash chmod +x dist/downloader ./dist/downloader ``` -------------------------------- ### Run from Source (Python) Source: https://nayandas69.github.io/Social-Media-Downloader/usage?q= Runs the tool directly from the source code. ```bash python3 -m smd ``` -------------------------------- ### Build silent version for Windows (no console window) Source: https://nayandas69.github.io/Social-Media-Downloader/build?q= Create a Windows executable without a terminal window, suitable for launching from desktop shortcuts or GUI. ```bash pyinstaller --onefile --noconsole smd/downloader.py ``` -------------------------------- ### Generate .spec file with pyi-makespec (PyInstaller onefile) Source: https://nayandas69.github.io/Social-Media-Downloader/troubleshooting?q= Command to generate a basic .spec file for the downloader project. Creates 'downloader.spec' in the project root. ```bash pyi-makespec --onefile --icon=assets/logo.ico smd/downloader.py ``` -------------------------------- ### Run SMD as a Python module Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Launch the CLI using python -m smd, useful in virtual environments or scripts. ```bash python -m smd ``` -------------------------------- ### Clean up build artifacts Source: https://nayandas69.github.io/Social-Media-Downloader/build?q= Remove build folder, __pycache__, and .spec files after packaging. Leaves source code and the dist/ folder containing the binary. ```bash rm -rf build __pycache__ *.spec ``` -------------------------------- ### Default config.json content Source: https://nayandas69.github.io/Social-Media-Downloader/config-info?q= The default configuration file generated on first launch. Contains default_format, download_directory, history_file, and mp3_quality settings. ```json { "default_format": "show_all", "download_directory": "media", "history_file": "download_history.csv", "mp3_quality": "192" } ``` -------------------------------- ### Clone repository Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Clones the GitHub repository and navigates to the project directory. ```bash git clone https://github.com/nayandas69/Social-Media-Downloader.git cd Social-Media-Downloader ``` -------------------------------- ### Rebuild with pyinstaller downloader.spec Source: https://nayandas69.github.io/Social-Media-Downloader/troubleshooting?q= Rebuilds the project using the edited spec file. Packages fonts correctly and produces a working binary inside the dist/ folder. ```shell pyinstaller downloader.spec ``` -------------------------------- ### Build console version for Windows with PyInstaller Source: https://nayandas69.github.io/Social-Media-Downloader/build?q= Create a Windows executable that opens a terminal/console window when run. ```bash pyinstaller --onefile smd/downloader.py ``` -------------------------------- ### Run SMD CLI with 'smd' command Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Launch the interactive menu from the terminal using the 'smd' command. ```bash smd ``` -------------------------------- ### Import all major functions from smd Source: https://nayandas69.github.io/Social-Media-Downloader/use-as-library?q= Import the main functions provided by the package for use in your Python code. ```python from smd import ( download_youtube_or_tiktok_video, download_instagram_post, extract_instagram_video_mp3, batch_download_from_file, check_for_updates, show_help, ) ``` -------------------------------- ### Generate downloader.spec with pyi-makespec Source: https://nayandas69.github.io/Social-Media-Downloader/troubleshooting Generates a basic .spec file named downloader.spec for the project. Use this before editing the spec to include the pyfiglet font data. ```bash pyi-makespec --onefile --icon=assets/logo.ico smd/downloader.py ``` -------------------------------- ### downloader.spec with collect_data_files('pyfiglet') Source: https://nayandas69.github.io/Social-Media-Downloader/troubleshooting?q= Replace the default spec file with this content. It uses collect_data_files to bundle pyfiglet font data. The Analysis datas value is set to this collected data, ensuring fonts are included in the executable. Save as downloader.spec. ```python # -*- mode: python ; coding: utf-8 -*- from PyInstaller.utils.hooks import collect_data_files datas = collect_data_files("pyfiglet") a = Analysis( ['smd/downloader.py'], pathex=[], binaries=[], datas=datas, hiddenimports=[], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], noarchive=False, optimize=0, ) pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, a.binaries, a.datas, [], name='downloader', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=True, disable_windowed_traceback=False, argv_emulation=False, target_arch=None, codesign_identity=None, entitlements_file=None, icon='assets/logo.ico', ) ``` -------------------------------- ### Rebuild with PyInstaller Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Rebuilds the executable using the edited spec file. ```bash pyinstaller downloader.spec ``` -------------------------------- ### Generate spec file for pyfiglet fix Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Generates a PyInstaller spec file to fix ModuleNotFoundError with pyfiglet. ```bash pyi-makespec --onefile smd/downloader.py ``` -------------------------------- ### Edit spec file Source: https://nayandas69.github.io/Social-Media-Downloader/faq Edit the .spec file to include pyfiglet data files. ```python from PyInstaller.utils.hooks import collect_data_files datas = collect_data_files("pyfiglet") ``` -------------------------------- ### Include pyfiglet data files in spec Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Adds PyInstaller hook code to the .spec file to collect pyfiglet font data files. ```python from PyInstaller.utils.hooks import collect_data_files datas = collect_data_files("pyfiglet") ``` -------------------------------- ### Error: ModuleNotFoundError for pyfiglet.fonts Source: https://nayandas69.github.io/Social-Media-Downloader/troubleshooting Shows the error message that appears when running the executable if PyInstaller did not bundle the font files used by pyfiglet. The script crashes on launch and ASCII banners are missing. ```text ModuleNotFoundError: No module named 'pyfiglet.fonts' ``` -------------------------------- ### Change MP3 quality Source: https://nayandas69.github.io/Social-Media-Downloader/faq?q= Edits the mp3_quality field in config.json to a higher value. ```json "mp3_quality": "320" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.