r/pythonhelp • u/ViridianGuy • Feb 22 '22
Issue with URL pasting in Python
Hey there, so recently I've been trying to make a Youtube Video Downloader, and for some reason when I input a FULL url it shows an error that goes something like: File "c:\Users\User\OneDrive\Desktop\The Youtube Video Downloader.py", line 10, in <module> video = YouTube(url)
Anyways Here Is The Script:
from pytube import YouTube
import time
print("The Youtube Video Downloader")
time.sleep(0.2)
print("\nBy: ViridianTelamon.")
time.sleep(0.2)
#url = input("\nInput The Full Url For The Youtube Video That You Want To Download (Shortened Urls Will Not Work): ")
url = input("\nInput The Url For The Video: ")
#print(f"Url Inputted: {url}")
#print(url)
video = YouTube(url)
time.sleep(0.2)
print("\n----------Video Title----------")
time.sleep(0.2)
print(video.title)
time.sleep(0.2)
print("\n----------Video Thumbnail Url----------")
time.sleep(0.2)
print(video.thumbnail_url)
time.sleep(2)
print("\n----------Video Download----------")
time.sleep(0.2)
video = video.streams.get_highest_resolution
video.download()
print("\nVideo Successful Downloaded In The Same Directory As This Script.")
1
u/[deleted] Feb 22 '22
As the
\symbol has a special meaning in Python, you may need to either escape the backslashes, e.g."\\text"instead of"\text", or use raw strings,r"\text".Need to see full traceback to check what the exact problem is.
EDIT: hit save too soon