Skip to content

dongshuyan/BiliSyncer

Repository files navigation

BiliSyncer Logo

BiliSyncer

🎯 Intelligent Bilibili Content Synchronization Tool - Automated sync management, incremental updates, and batch downloads

Python License WebUI

πŸ‡¨πŸ‡³ δΈ­ζ–‡ζ–‡ζ‘£ | πŸ‡ΊπŸ‡Έ English

🌟 Overview

BiliSyncer is an intelligent synchronization management tool specifically designed for continuously updating Bilibili content. It focuses on solving the automated synchronization challenges of user favorites, UP master uploads, anime series, and other continuously updating resources. Built upon yutto, it provides a complete resource management ecosystem that makes content management simple and efficient.

✨ Core Advantages

🎯 Intelligent Resource Discovery & Recognition

  • Precise Resource Targeting - Automatically retrieves complete and accurate video lists from favorites, UP master uploads, etc., without omissions or redundancy
  • Smart Update Detection - Automatically identifies all new content since the last sync, avoiding redundant requests and invalid operations
  • Comprehensive Content Support - Full support for user videos, anime, movies, courses, favorites, collections, and more

πŸ”„ Advanced Synchronization Management

  • Incremental Sync Technology - Only synchronizes new and changed content, dramatically saving time and bandwidth
  • Resume Protection - Automatically recovers from network interruptions or unexpected stops, ensuring download continuity
  • Persistent Status Tracking - CSV-based progress management ensures sync records are never lost

🧹 One-Click Cleanup & Space Management

  • Smart Cleanup Function - Supports one-click cleanup of all downloaded files after backup completion, freeing storage space
  • Record Retention Mechanism - Preserves complete download records while cleaning files, providing foundation for future incremental syncs
  • Storage Optimization Strategy - Flexible file management strategies adapted to different storage scenarios

βš™οΈ Versatile Configuration Management

  • Multi-Account Support - Supports independent configuration and management of multiple Bilibili accounts for different permission needs
  • Differentiated Configuration - Provides independent parameter configuration schemes for different download requirements
  • Configuration Templating - Preset common configuration templates for quick application to different task scenarios

πŸ“Š Visual Monitoring & Analytics

  • Real-Time Task Monitoring - Intuitively displays execution status and progress information of all sync tasks
  • Historical Record Analysis - Automatically tracks sync history and provides detailed task execution reports
  • Resource Status Overview - At-a-glance view of sync status and storage information for all resources

πŸ”§ Granular Task Scheduling

  • Concurrent Task Management - Supports parallel execution of multiple tasks, maximizing system resource utilization
  • Task Lifecycle Control - Provides complete control functions for task start, pause, stop, restart, etc.
  • Priority Scheduling - Supports task priority settings to prioritize important resources

🎨 Intuitive & User-Friendly Web Interface

  • Modern Design - Clean and beautiful responsive web interface adapted to various devices
  • Operational Simplicity - Intuitive operation flow reduces learning costs and enhances user experience
  • Feature Integration - All management functions centralized in a unified interface, avoiding complex command-line operations

⚑ Efficient Command Line Interface

  • Batch Processing Capability - Powerful CLI support for easy script invocation and automation integration
  • Parameter Flexibility - Rich command-line parameters meeting advanced users' fine-grained control needs
  • Program Integration Friendly - Easy integration into other automation systems and workflows

πŸ†š BiliSyncer vs Yutto vs Yutto-uiya

Feature BiliSyncer Yutto Yutto-uiya
Core Purpose Continuous sync management Versatile CLI downloader Simple WebUI wrapper
Sync Capability βœ… Smart incremental sync βž– Manual re-execution required βž– Manual re-execution required
Resource Management βœ… Complete lifecycle management βž– Download-only functionality βž– Download-only functionality
Interface Type Professional Web Dashboard Powerful Command Line User-friendly Streamlit UI
Download Engine Built on yutto Original robust engine Built on yutto
Batch Operations βœ… Multi-task management βœ… Batch download support βœ… Basic batch support
Resume Downloads βœ… Automatic detection βœ… Built-in resume capability βœ… Inherits yutto's resume
Status Persistence βœ… CSV-based tracking βž– Session-based only βž– Session-based only
Configuration βœ… Web + YAML management βœ… Rich CLI options βœ… Simple web forms
Content Organization βœ… Structured folder naming βœ… Flexible path templates βœ… Basic organization
Learning Curve 🟒 Beginner-friendly 🟑 Technical users 🟒 Very easy
Use Case Continuous content management Power user downloads Casual downloading

🎯 Each Tool's Strength

Yutto: The robust foundation - powerful, fast, and highly configurable CLI tool perfect for technical users who need maximum control and performance.

Yutto-uiya: The accessibility bridge - brings yutto's power to casual users through a clean, simple web interface without complexity.

BiliSyncer: The management layer - focuses on automated synchronization management of continuously updating content, providing complete resource lifecycle solutions.

πŸ“± Interface Preview

Download Management Interface

Download Management

Batch Update Interface

Batch Updates 1 Batch Updates 2

Task Status Interface

Task Status

Configuration Management Interface

Configuration Management

πŸš€ Quick Start

Prerequisites

# Install dependencies
pip install yutto
pip install -r requirements.txt

Launch Web Interface

python start_webui.py
# Visit http://localhost:5000

Command Line Usage

# Single download
python main.py "https://www.bilibili.com/video/BV1xx411c7mD"

# With additional options
python main.py "URL" --vip-strict --save-cover

# Batch update all configured tasks
python main.py --update -c "SESSDATA"

# Use custom configuration
python main.py "URL" --config vip

πŸ”§ Configuration

Create config/your_config.yaml:

name: "My Config"
output_dir: "~/Downloads"
sessdata: "your_sessdata_here"
vip_strict: true
save_cover: true
extra_args: ["--quality", "8K"]

Getting SESSDATA: Login to bilibili.com β†’ F12 β†’ Application β†’ Cookies β†’ Copy SESSDATA value

πŸ› οΈ Utility Tools

Directory Size Analysis Tool

tools/dir_tree_size.py is a directory size analysis tool that displays directory structure in tree format and sorts by size.

Features:

  • πŸ“Š Tree-style Display - Shows directories and files in a tree structure
  • πŸ“ˆ Smart Sorting - Sorts by size from smallest to largest for easy identification
  • πŸ” Auto Check - Automatically checks video file status in leaf directories (bottom-level directories)
  • πŸ“ Issue Report - Automatically generates check reports listing problematic directories

Usage:

# Basic usage (automatically checks and generates report)
python3 tools/dir_tree_size.py "/path/to/directory"

# Skip checking, only show directory structure
python3 tools/dir_tree_size.py "/path/to/directory" --no-check

Check Features:

  • βœ… Missing mp4 Files - Detects if leaf directories are missing .mp4 files
  • βœ… m4s Files Present - Detects if .m4s files exist in leaf directories (usually incomplete downloads or fragmented files)

Report Generation:

  • Check reports are automatically generated in the checked directory
  • Filename format: directory_name_ζ£€ζŸ₯ζŠ₯ε‘Š_timestamp.log
  • Report includes: List of problematic directories, specific issue types, statistics

Example Output:

/path/to/Bilibili/ (1.23 TB)
β”œβ”€β”€ η•ͺ剧-33415-εδΎ¦ζŽ’ζŸ―ε—οΌˆδΈ­ι…οΌ‰ (50.2 GB)
β”‚   β”œβ”€β”€ BV1xx411c7mD-第1集 (500 MB)
β”‚   └── BV1xx411c7mE-第2集 (480 MB)
└── 攢藏倹-123456-ζˆ‘ηš„ζ”Άθ— (30.5 GB)

Report generated: /path/to/xxx_ζ£€ζŸ₯ζŠ₯ε‘Š_20250116_123456.log
Found 5 leaf directories with issues

Directory Flattening Tool

flatten.py is a directory flattening tool that flattens directory structures at a specified level, moving files from subdirectories to parent directories and removing empty subdirectories.

Features:

  • πŸ“ Level-based Flattening - Flattens directory structures at specified depth levels
  • ⚑ Multi-threaded Processing - Supports parallel file moving with multiple threads for faster processing
  • πŸ” Preview Mode - Supports --dry-run mode to preview operations without actually executing them
  • πŸ—‘οΈ Hidden File Handling - Option to delete or keep hidden files (files starting with .)
  • πŸ”’ Safe Operation - Automatically handles filename conflicts to prevent file overwriting

Usage:

# Flatten level 1 directories (default: delete hidden files)
python3 flatten.py "/path/to/directory" -n 1

# Preview mode, don't actually execute operations
python3 flatten.py "/path/to/directory" -n 1 --dry-run

# Flatten level 2 directories, keep hidden files, 8 threads
python3 flatten.py "/path/to/directory" -n 2 --keep-hidden --jobs 8

# Flatten level 1, delete hidden files, 4 threads, preview mode
python3 flatten.py "/path/to/directory" -n 1 --delete-hidden --jobs 4 --dry-run

Parameters:

  • -n, --level - Level to flatten (relative to root, root depth is 0), default 0
  • -j, --jobs - Maximum parallel threads, default 8
  • --delete-hidden - Delete all hidden files starting with . (default behavior)
  • --keep-hidden - Keep hidden files, don't delete
  • --dry-run - Preview mode, only print operations to be performed, don't actually move/delete files

Use Cases:

  • πŸ“¦ Simplify Directory Structure - Flatten multi-level nested directory structures for easier management
  • 🎬 Video File Organization - Move downloaded video files from subdirectories to main directory
  • 🧹 Clean Empty Directories - Automatically remove empty subdirectories after flattening

Notes:

  • Tool automatically skips hidden directories (starting with .) to protect system directories like .git
  • If files with the same name exist at destination, they will be automatically renamed to name__dup1.ext, name__dup2.ext, etc.
  • It's recommended to use --dry-run mode first to preview results before actual execution

🎯 Perfect For

  • Content Creators - Continuously track and backup latest uploads from followed UP masters
  • Educators - Automatically sync course updates and educational resources
  • Media Collectors - Intelligently manage updates from favorites and watchlists
  • Researchers - Automate collection and organization of research-related video materials

πŸ› οΈ Tech Stack

Built with Python 3.8+, Flask, yutto, and modern web technologies for reliability and performance.

🀝 Contributing

We welcome contributions! Submit Issues or Pull Requests to help improve BiliSyncer.

πŸ“œ License

MIT Licensed - see LICENSE for details.


⭐ Star this project if it helps you manage your Bilibili content!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors