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}",
    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 filter

from zytools.utils import UrlFilter

url_filter = UrlFilter(file_path="url_seen.lmdb")

url = "https://example.com/video?id=1"

if url_filter.add(url):
    print("new url")

url_filter.close()

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.6.tar.gz (13.5 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.6-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file zytools_fs-0.0.6.tar.gz.

File metadata

  • Download URL: zytools_fs-0.0.6.tar.gz
  • Upload date:
  • Size: 13.5 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.6.tar.gz
Algorithm Hash digest
SHA256 238a9c9fc6be79bf491268e84eeee85ea57237136e4cec0f2b33fa3794382400
MD5 45714f3d4d2167512f915964292b845f
BLAKE2b-256 e1df44eb5fa6d7414bf528043b55cb60f76723ad8fcaf72a3f378535f9906cff

See more details on using hashes here.

File details

Details for the file zytools_fs-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: zytools_fs-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 14.2 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a274e6f9a59ccdf1994ac3bb7f3dd0b95574afb6172511f53bed18742855e8e9
MD5 2676345588c297abeaa75763a0965b85
BLAKE2b-256 cf5886efb57c0ca723a6df7f1b0019178a3954601990fe94ecc8c6da792a498a

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