Skip to main content

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zytools_fs-0.0.4-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

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

Hashes for zytools_fs-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7fbba00ea41fd90b25b2327890f53124d8e05de53b336341d2cd24a81bc5b175
MD5 5be7344d46497b16ce05cece0ac6bddf
BLAKE2b-256 8ecd81a15c5267161bffea339aa0bd0967352b221686e1099cdae2b50c3faf3c

See more details on using hashes here.

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

Hashes for zytools_fs-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cd5471cd8e7e17f5b51643d7d84092adee276d7b8958a1f7734b3aad47d445b3
MD5 5f42c38b93080929892be6e0de97b427
BLAKE2b-256 6c47eab3f45625f7df7fa407894cd5e0dcc03aef87cf29568c0d7d387c13a847

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page