A library that helps downloading videos from cda.pl
Project description
CDA_download
A library that helps download videos from CDA website
Installation:
pip install cda_download
How to use:
from pycda import PyCDA
url = "CDA url"
cda = PyCDA(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 pycda import PyCDA
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 = PyCDA(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 pycda import PyCDA
url = "cda url"
cda = PyCDA(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 pycda import PyCDA
url = "CDA url"
cda = PyCDA(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.4.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for cda_download-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca3f13396270d588a1c2d1b6fe43d4ea0948a05f15caad5b5bd477652c563f3c |
|
MD5 | f18f3bc5b0e19dc97788d8fb1d154b95 |
|
BLAKE2b-256 | aaf4b7a5df6d4755002ea77e8cb3685bb84cf30bdb745a07a3edf0c663eac250 |