Files
Dat_Boi/misc/scripts/ytDownloader.py
2024-05-05 13:22:35 +02:00

29 lines
790 B
Python

# coding: utf-8
from pytube import YouTube
import os
#ask for the link from user
names = []
links = []
for link in links:
yt = YouTube(link)
#Showing details
print("Title: ",yt.title)
print("Number of views: ",yt.views)
print("Length of video: ",yt.length)
print("Rating of video: ",yt.rating)
#Getting the highest resolution possible
ys = yt.streams.filter(only_audio=True).first()
#Starting download
print("Downloading...")
ys.download(output_path=f"/home/ninluc/Documents/codage/discord/Dat_Boi/sounds/")
os.rename(f"/home/ninluc/Documents/codage/discord/Dat_Boi/sounds/{yt.title}.mp4", f"/home/ninluc/Documents/codage/discord/Dat_Boi/sounds/{yt.title}.mp3")
print("Download completed!!")
names.append(yt.title)
print(names)