Personal Python utilities for FTP and video downloads
Project description
zytools-fs
Personal Python utilities for FTP and video downloads.
Install
pip install zytools-fs
FTP download
from zytools.utils.ftp import FTPDownloader
with FTPDownloader(host="127.0.0.1", user="user", password="password") as ftp:
ftp.download("/remote/path", "./downloads")
Bilibili video download
from zytools.video import download_bili_video
download_bili_video(
"https://www.bilibili.com/video/BVxxxx",
output_dir="./downloads",
filename="Bilibili_{BV}_{Date}_{Part}_{Duration}",
)
Filename template fields:
{Title}: video title{BV}: BV id{Date}: publish date,YYYYMMDD{Page}: page number{Part}: page number{Duration}: duration in seconds{PartTitle}: page title
Task update
from zytools.utils import TaskUpdater, update_task
update_task(
name="daily job",
machine_id="machine-1",
script_path="/path/to/script.py",
server="http://127.0.0.1:8000",
)
task = TaskUpdater(
name="daily job",
machine_id="machine-1",
script_path="/path/to/script.py",
)
task.update()
URL bloom filter
from zytools.utils import UrlFilter
url_filter = UrlFilter(capacity=100_000)
url = "https://example.com/video?id=1"
if url_filter.is_new(url):
print("new url")
url_filter.add(url)
url_filter.save()
MongoDB helper
Install the optional dependency:
pip install "zytools-fs[mongo]"
from zytools.utils import MongoHelper
with MongoHelper("mongodb://127.0.0.1:27017", "demo") as mongo:
mongo.upsert_one(
"users",
{"_id": "user-1"},
{"name": "Alice"},
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zytools_fs-0.0.4.tar.gz
(13.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zytools_fs-0.0.4.tar.gz.
File metadata
- Download URL: zytools_fs-0.0.4.tar.gz
- Upload date:
- Size: 13.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fbba00ea41fd90b25b2327890f53124d8e05de53b336341d2cd24a81bc5b175
|
|
| MD5 |
5be7344d46497b16ce05cece0ac6bddf
|
|
| BLAKE2b-256 |
8ecd81a15c5267161bffea339aa0bd0967352b221686e1099cdae2b50c3faf3c
|
File details
Details for the file zytools_fs-0.0.4-py3-none-any.whl.
File metadata
- Download URL: zytools_fs-0.0.4-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd5471cd8e7e17f5b51643d7d84092adee276d7b8958a1f7734b3aad47d445b3
|
|
| MD5 |
5f42c38b93080929892be6e0de97b427
|
|
| BLAKE2b-256 |
6c47eab3f45625f7df7fa407894cd5e0dcc03aef87cf29568c0d7d387c13a847
|