How zephyris-pro/vkdownloader works
Project Type and Purpose
• This is a command-line utility (open-source tool) written in Python.
• Purpose: scrape and download files (PDFs, images, audio, etc.) from a specified URL or list of URLs (batch mode).
Top-Level File Structure and Roles
• vk_downloader.py – core downloader CLI.
• batch_download_file_creator.py – reads a text file of URLs, extracts titles, generates a Windows batch (.cmd) script to drive vk_downloader.exe for each URL.
• requirements.txt – Python dependencies.
• build.{sh,bat} & install.{sh,bat} – scripts to build a frozen/packaged executable (vk_downloader.exe) and install dependencies.
• assets/ – any static resources (e.g., logos, sample templates).
Main Components
a. User/CLI Layer
• User’s shell (bash/cmd) invoking either vk_downloader.py or the generated batch_download.cmd.
b. Argument Parser
• Parses URL, output_dir, file_type, threads flags (uses argparse).
c. Download Engine
• HTTP Client Module (e.g., requests)
• Concurrency/Thread Pool managing simultaneous downloads
d. HTML Parser & Title Extractor
• CSS selector for div.bt_title
• Fallback to <title> tag or regex
e. File Manager
• Creates output directories
• Saves binary files to disk
f. Batch Script Generator
• Reads URLs from text file
• Invokes title extractor logic to name folders
• Writes batch_download.cmd containing repeated vk_downloader.exe invocations with flags
g. External Service
• VK.com web server (target of HTTP requests)
h. Build & Install Subsystem (auxiliary)
• build.sh/.bat: package into an executable (e.g., via PyInstaller)
• install.sh/.bat: install dependencies
Relationships and Data Flow
• User → (CLI) Argument Parser → Download Engine
• Download Engine ↔ External Service (HTTP GETs)
• Download Engine → File Manager (write files)
• batch_download_file_creator.py → Batch Script Generator → batch_download.cmd
• batch_download.cmd (shell script) → multiple vk_downloader.exe invocations → same download flow
Architectural Patterns & Principles
• Single-responsibility: separate modules for downloading vs. batch generation.
• Modular CLI design: each script has its own entry point and argument parsing.
• Layered I/O: clear separation between network I/O, parsing, and filesystem I/O.
Technologies & Frameworks
• Python 3.x
• requests (HTTP client)
• argparse (CLI argument parsing)
• threading or concurrent.futures for multi-threaded downloads
• PyInstaller (or similar) for packaging into vk_downloader.exe
• Windows batch scripting (batch_download.cmd)