Pytube on Linux server returns links not working. Strange problem

51 Views Asked by At

To make the problem clear I will give this code example :

from pytube import YouTube

video = YouTube("https://www.youtube.com/watch?v=sMvk9kE94uE")
streams = video.streams.filter(progressive=True)
# let's say the video with 720p quality is the third one in the list
print(streams[2].url)

This exact code, when I run it on my windows 10 computer, it returns the right URL that can be downloaded, and when I run it on my ubuntu Linux server it returns a URL that doesn't work and just keeps loading.

Here is a photo : enter image description here

Sometimes, and only sometimes, the left code returns a correct URL.

I don't understand why is that. The only difference is the operating system.

Please try to provide me with any suggestion to solve this problem. If any more detail is needed, I will add it directly.

0

There are 0 best solutions below