r/pythonhelp • • 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.")

0 Upvotes

13 comments sorted by

View all comments

Show parent comments

1

u/MT1961 Feb 22 '22

A 410 error indicates that the target resource is no longer available at the server. This was a known issue in PyTube for a while, apparently fixed in version 11.0:

https://lifesaver.codes/answer/bug-http-error-410-gone-1076

You might try the upgrade suggested there.

1

u/ViridianGuy Feb 22 '22

How would you update it?

1

u/MT1961 Feb 23 '22

You use something like this:

pip install --upgrade <package-name>

You can add --user if you want it in your user directory instead of system wide.

1

u/ViridianGuy Feb 23 '22

This is what I got:

C:\Users\User>pip install --upgrade

PyTubeRequirement already satisfied: PyTube in c:\users\user\appdata\local\programs\python\python310\lib\site-packages (12.0.0)