# ๐Ÿ“บ Bilibili Video Downloader > A Python tool to **download videos from Bilibili (B็ซ™)** with WBI signature authentication, multi-quality selection, and optional ffmpeg audio+video merging. **Bilibili Video Downloader** downloads videos from Bilibili by BV URL. It implements the WBI signature algorithm for API authentication, picks the best available MP4 quality, and supports downloading with **aria2** (fast) or pure-Python fallback, then optionally merges audio & video with **ffmpeg**. --- ## ๐Ÿ“ฆ Files | File | Description | |------|-------------| | `bilibili_downloader.py` | Standard version โ€” fill in your `sessdata` cookie manually | | `bilibili_downloader_auto.py` | Auto version โ€” edit the `sessdata` variable inside the script | > Both files have identical features. The difference is only how the cookie is provided. --- ## โœจ Features | Feature | Description | |---------|-------------| | ๐Ÿ”‘ **WBI Signature** | Implements Bilibili WBI signing algorithm for authenticated API calls | | ๐ŸŽž๏ธ **Best MP4 Quality** | Automatically picks the highest available MP4 stream | | ๐Ÿงช **URL Test** | Verifies content URL accessibility before download | | โšก **aria2 Support** | Uses aria2 for fast parallel downloads (if installed) | | ๐Ÿ **Pure-Python Fallback** | If aria2 is unavailable, downloads directly via Python | | ๐ŸŽฌ **ffmpeg Merge** | Merges separate video + audio streams into one file | | ๐Ÿ“„ **Info Fetch** | Retrieves video metadata (title, etc.) via BV URL | --- ## ๐Ÿš€ Quick Start ### Prerequisites - Python 3.7+ - `requests` library - **Cookie** (`sessdata`) โ€” required for Bilibili access - Optional: `aria2` (fast), `ffmpeg` (audio/video merge) ### Install ```bash pip install requests ``` ### Setup Cookie 1. Log in to Bilibili in your browser 2. Open DevTools โ†’ Application โ†’ Cookies โ†’ find `sessdata` 3. Paste it into the script: **`bilibili_downloader.py`** (fill at runtime or edit variable): ```python sessdata = "" # <-- paste your sessdata ``` **`bilibili_downloader_auto.py`** (edit variable directly): ```python sessdata = 'ๅกซๅ†™ไฝ ็š„Cookie' # <-- replace with your sessdata ``` ### Run ```bash python bilibili_downloader.py # or python bilibili_downloader_auto.py ``` Enter a Bilibili video BV URL when prompted (e.g. `BV1xx411c7mD`). --- ## ๐Ÿ“ Project Structure ``` Bilibili-Video-Downloader/ โ”œโ”€โ”€ bilibili_downloader.py # Standard version โ”œโ”€โ”€ bilibili_downloader_auto.py # Auto version (cookie in script) โ””โ”€โ”€ README.md # This document ``` --- ## ๐Ÿ“„ License This project is licensed under the **MIT License**. See [LICENSE](LICENSE) for details. --- ## โš ๏ธ Disclaimer > This tool is for **personal learning and research only**. Please respect Bilibili's Terms of Service and content creators' copyright. Do not redistribute downloaded content. Use at your own risk.