Home > front end >  Python: Download video with Youtube and pytube - fix error (regex...)
Python: Download video with Youtube and pytube - fix error (regex...)

Time:11-26

When I try to run the code below, it gives me the response: "Python: Download video with Youtube and pytube - fix error (regex...)" Tried multiple solutions, all to no avail.

Here is my code:

link = "https://www.youtube.com/watch?v=vEQ8CXFWLZU&t=475s&ab_channel=InternetMadeCoder"

yt = YouTube(link)

print(yt.title)

I have tried to reinstall pytube and I have tried downloading it from github but the problem still occurs.

CodePudding user response:

I tried the following code:

from pytube import YouTube

link = "https://www.youtube.com/watch?v=vEQ8CXFWLZU&t=475s&ab_channel=InternetMadeCoder"
yt = YouTube(link)
print(yt.title)

OUTPUT:

3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS

Perhaps try creating a new environment - as you may be experiencing a conflict with another package?

I am also using Python 3:

>>> sys.version
'3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]'

CodePudding user response:

I ran this on my IDE:

from pytube import YouTube

video = 'https://www.youtube.com/watch?v=4-43lLKaqBQ'

yt = YouTube(video)

print(yt.title)

Response:

The Animals - House of the Rising Sun (1964) HQ/Widescreen ♫ 58 YEARS AGO

Any chance that you can show us your python version? :)

CodePudding user response:

Working correctly with pytube 12.1.0 & Python 3.10.8. Check version of pytube.

  • Related