Thanks to visit codestin.com
Credit goes to lib.rs

#bilibili #fav #bili

bin+lib fav_bili

Back up your favorite bilibili online resources with CLI

18 releases (stable)

Uses new Rust 2024

1.2.0 Oct 11, 2025
1.1.1 Jul 20, 2025
1.1.0 Jun 22, 2025
1.0.0-alpha.7 May 31, 2025

#11 in Multimedia

Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

193 downloads per month

MIT license

130KB
3.5K SLoC

A CLI tool to download your favorite Bilibili medias from up and favorite collections.

Need ffmpeg usable, and added to the PATH.

Back up your favorite bilibili online resources with CLI.

Usage: fav [OPTIONS] [COMMAND]

Commands:
  auth        Auth account
  list        List accounts/sets/ups/medias [alias: ls, l]
  activate    Activate obj [alias: active, a]
  deactivate  Deactivate obj [alias: d]
  fetch       Fetch metadata of following ups, fav sets, medias, ups [alias: f]
  pull        Pull fetched medias [alias: p]
  like        Like medias
  completion  Generate completion script
  help        Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose  Show debug messages
  -h, --help     Print help
  -V, --version  Print version

Steps

  1. Login first
  2. Fetch the favorite sets(lists)
  3. Activate the list or up you want. You can see them through fav ls
  4. Fetch active resources
  5. Pull the resources

Example

# auto completion is supported; e.g. fish
fav completion fish > ~/.config/fish/completions/fav.fish
# For Windows users
echo "fav completion powershell | Out-String | Invoke-Expression" >> $PROFILE
# scan code to login
fav auth login
# you can also login with `fav usecookies`
# fetch following ups and fav sets
fav fetch
# show sets
fav ls set
# activate set or up
fav activate
# pull videos
fav fetch
fav pull
# deactivate set or up
fav deactivate
# after fetching, you can find your favorite upper
# limbo/sqlite3 .fav/fav.db
SELECT u.up_id, u.name, COUNT(u.up_id) count FROM up u LEFT JOIN media_up mu ON u.up_id=mu.up_id JOIN media m ON mu.id=m.id GROUP BY u.up_id, u.name ORDER BY count;
# you can also like medias, should usecookies when login
fav like
# or like all medias faved
fav ls v | sed '1d;$d' | awk '{print $2;}' | xargs fav like
# check cookies usability
fav auth check -a

Service example:

# /etc/systemd/system/fav.service
[Unit]
Description=Fav Service
After=network-online.target

[Service]
Type=oneshot
User=your_user
WorkingDirectory=/path/to/fav_set
ExecStart=/bin/sh -c "/usr/local/bin/fav fetch && /usr/local/bin/fav pull"

# /etc/systemd/system/fav.timer
[Unit]
Description=Run fav service every 3 hours

[Timer]
OnCalendar=*-*-* 0/3:00:00
# or OnUnitActiveSec=3h
AccuracySec=1m
Persistent=true

[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable fav.timer
sudo systemctl start fav.timer

Dependencies

~60–81MB
~1.5M SLoC