Forums

youtube_dl - forbidden error 403: unable to download utube videos.

Hi everyone, I’m a beginner learning how to code. Recently, I built a little web app using flask with python3.8. I managed to host the app on pythonanywhere with a free account, so my friends can access it and test the app.

One of the functionalities of my app is that it can download a utube video and convert it into a mp3 file via url using the youtube_dl module, which worked fine when I was running the app locally on my computer using flask’s local host. However, doing the same thing on pythonanywhere’s server, I received the following error -‘download webpage: <urlopen error Tunnel connection failed: 403 Forbidden>‘.

It would be appreciated if someone could tell me what went wrong. Thanks

Youtube is not whitelisted for free users as we only whitelist public documented APIs. See https://www.pythonanywhere.com/whitelist/