Back up your favorite bilibili resources with CLI.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Back up your favorite bilibili online resources with CLI.
You can download the release here (Due to ffmpeg dynamic linking, version >= 1.1.0 is not provided in release page, you can compile by yourself.).
For Arch Linux users, you can yay -S fav-git
maybe, someone has maken it a package.
Or you can compile by yourself:
- Install ffmpeg and pkgconf
# e.g. sudo pacman -S ffmpeg pkgconf # or brew install ffmpeg pkgconf
- Clone the repo
git clone https://github.com/kingwingfly/fav.git
- Compilation
cargo build --release
Or after installing ffmpeg and pkgconf, run cargo install fav_bili
.
Need libavformat
able to be dynamic linked (pkgconf --list-all | grep libav
).
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
- Login first
- Fetch the favorite sets(lists)
- Activate the list or up you want. You can see them through
fav ls
- Fetch active resources
- Pull the resources
# 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 >
AccuracySec=1m
Persistent=true
[Install]
WantedBy=timers.target
sudo systemctl daemon-reload
sudo systemctl enable fav.timer
sudo systemctl start fav.timer
You can also achieve the goal with systemd timer
by yourself, but it's a little hard to learn.
For more examples, please refer to the Documentation
sea-orm-cli
is used to handle database ops.
cargo binstall sea-orm-cli # or `cargo install sea-orm-cli`
# generate ORM code
./sea-orm.sh
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. Moreover, it is recommended to open an issue before coding to avoid repeated and useless work.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
Distributed under the MIT License. See LICENSE.txt
for more information.
Louis - 836250617@qq.com
Project Link: https://github.com/kingwingfly/fav