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

Uploaded Python 3

File details

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

File metadata

  • Download URL: zytools_fs-0.0.7.tar.gz
  • Upload date:
  • Size: 20.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.7.tar.gz
Algorithm Hash digest
SHA256 2f5ca77b94ec216c5755c36eff0c414dfac961f98b0739cdd64d50b541fca398
MD5 4cd108627bc42badfaea67a3f100a99a
BLAKE2b-256 30da8c36a33eeb8a0fc045014e061e41782d9ad89f5ce8a9459ecfc98f86d09f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zytools_fs-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 22.1 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fd38f357ec4407b9e0c31c9bdf223fd2de0e5a0a02c878eae409604a62fe48bd
MD5 819e9754341ea82e0db799043dd1a8aa
BLAKE2b-256 84dd8c68db9791184fc194d9f9cbda2704670bbdb519fd8a2f8ea760c8280725

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