Skip to main content

A library that helps downloading videos from cda.pl

Project description

CDA_download

PyPI - Downloads

A library that helps download videos from CDA website

Installation:

pip install cda_download

How to use:

from cda_download import CdaDownload

url = "CDA url"

cda = CdaDownload(url=url)
cda.download()

Additional features:

Progress callback

If you need to get progress like percentage or download speed, you can create a function and pass as a parameter in the download method.

from datetime import datetime, timedelta
from cda_download import CdaDownload

download_start_time = datetime.now()
last_update_time = datetime.now()

def show_progress(count, block_size, total_size):
        global last_update_time

        # download speed
        elapsed_time = (datetime.now() - download_start_time).total_seconds()
        download_speed = (count * block_size) / (1024 * elapsed_time)

        # progress
        progress = min(1.0, count * block_size / total_size)

        current_time = datetime.now()
        if (current_time - last_update_time) >= timedelta(seconds=1):
            print(f'\rDownloading: {progress:.2f} complete', end='')
            print(f' | Speed: {download_speed:.2f} KB/s', end='')
            last_update_time = current_time


url = "CDA url"

cda = CdaDownload(url=url)
cda.download(on_progress_callback=show_progress)

Filename

You can pass filename as a parameter in the form of a string to specify download location. Using download method without the filename parameter will save the file to where your script is located.

from cda_download import CdaDownload

url = "cda url"

cda = CdaDownload(url=url)
output_path = "D:/Downloads/title.mp4"

cda.download(filename=output_path)

Other data

Apart from downloading, you can access other data about CDA video:

from cda_download import CdaDownload

url = "CDA url"
cda = CdaDownload(url=url)

# video title
print(cda.title())

# channel name
print(cda.channel())

# video description
print(cda.description())

# video publish date
print(cda.publish_date())

# video duration
print(cda.duration())

# file size in bytes
print(cda.filesize())

# thumbnail image
print(cda.thumbnail())

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

cda_download-0.0.9.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

cda_download-0.0.9-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file cda_download-0.0.9.tar.gz.

File metadata

  • Download URL: cda_download-0.0.9.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for cda_download-0.0.9.tar.gz
Algorithm Hash digest
SHA256 a8bd210d7a764d2fedf5e094bb2b4089a066f0dabb86eadba16963c1f97cd228
MD5 37f58ce3554d04cf78dfd6b7081eb77c
BLAKE2b-256 04dd6f6a6eb15dca36377a7bf549e93f3ea5d2630417e5c58995e66f222d1fca

See more details on using hashes here.

File details

Details for the file cda_download-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: cda_download-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for cda_download-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 708618b622f527442e06bbb38a7b9e78931a55714031961acc3136d8541897d5
MD5 36dccd5c66056d9b450b908599a7c951
BLAKE2b-256 b5dbb66dc9f625f1c32afa53888c9a593a9a0d724f73a5a55f3402fc0a993280

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