Pytube giving pytube.exceptions.VideoUnavailable error

Hey everyone ,

So I’m working on a platform and one of the steps in that is that a user inputs a youtube link and the mp3 file of that video is downloaded using pytube. Now when I try deploying my app it gives me the following error even though it works locally on my system.

here are my requirements, and packages files as well


would appreciate it if someone could guide me as to how to overcome this issue , thanks .

You might find relevant details in the logs, but this is probably Google saying no video for you, maybe due to geo-blocking or age restrictions.

Hi there ,

I double checked in terms of location and age restriction , normally the video is available to me , its just giving an error when I try to access the video through pytube where the trouble starts

What did you check exactly? Your computer probably is (or appears to be, if you are using a VPN) in a different location than the Streamlit Cloud servers and you can be logged into your Youtube account, so different restrictions can apply

IIUC you said that the application works in your computer, so it is not pytube or the application but the environment where it is running.

Sorry i just remembered i had to change up some expressions in the pytube files to get it to work locally . Particularly had to change the regex expression it looks for in the file . Would there be a way to upload the working pytube files to my repo and then apply that in my streamlit app

You already have files in your repo, you want to add some more files, how is that a problem? Or I am misunderstanding?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.