Basic working script
Updated the gitnore for media files.
This commit is contained in:
30
download.py
Normal file
30
download.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import yt_dlp as yt
|
||||
|
||||
def get(yt_url):
|
||||
ytdl_options = {
|
||||
'continuedl': True,
|
||||
'ignoreerrors': True,
|
||||
'outtmpl': '%(title)s.%(ext)s',
|
||||
'no_warning': True,
|
||||
'progress_hooks': [dl_progress],
|
||||
#'quiet': True,
|
||||
'writethumbnail': True,
|
||||
'embed_metadata': True,
|
||||
'format': 'any/bestaudio/best',
|
||||
# ℹ️ See help(yt_dlp.postprocessor) for a list of available Postprocessors and their arguments
|
||||
'postprocessors': [{ # Extract audio using ffmpeg
|
||||
'key': 'FFmpegMetadata'
|
||||
},{
|
||||
'key': 'FFmpegExtractAudio',
|
||||
'preferredcodec': 'mp3',
|
||||
|
||||
}]
|
||||
}
|
||||
|
||||
with yt.YoutubeDL(ytdl_options) as ytdl:
|
||||
ytdl.download(yt_url)
|
||||
|
||||
|
||||
def dl_progress(d):
|
||||
if (d['status'] == 'finished'):
|
||||
print("\nDownload completed.")
|
||||
Reference in New Issue
Block a user