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}",
cookie={"SESSDATA": "your_sessdata", "bili_jct": "your_bili_jct"},
)
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.5.tar.gz
(14.0 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.5.tar.gz.
File metadata
- Download URL: zytools_fs-0.0.5.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2ec05a3166b64638ac921a74c740737c652703ef575f0769491cf1822a58b46
|
|
| MD5 |
5caecd984521a11707a5c2ab666fe7ab
|
|
| BLAKE2b-256 |
5c232ce6df7f7bc64526b8a7e5d95cdd48eb39d9532819165ae40b7533887ba8
|
File details
Details for the file zytools_fs-0.0.5-py3-none-any.whl.
File metadata
- Download URL: zytools_fs-0.0.5-py3-none-any.whl
- Upload date:
- Size: 14.7 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 |
26a9614d5de2c09701ce2f6fc75b0a1d6f70fe4206ea31b19920c191c6fc973d
|
|
| MD5 |
c0704a97496b8d7a3cc216ebae99ed6f
|
|
| BLAKE2b-256 |
24698d463620aaa23ce9f61c6cfb3cafc0f855fd7428cb5ae6f8ebaf00c7ec33
|