https://www.pythonanywhere.com/forums/topic/2688/で強調表示されている問題と同様の問題があります
唯一の違いは、フラスコを使用していることと、使用しているモジュールが pytube であることです。あなたが助けてくれると信じています。表示されるエラーメッセージは次のとおりです。
Traceback (most recent call last):
File "/home/*username*/.virtualenvs/*project*/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/*username*/.virtualenvs/*project*/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/*username*/.virtualenvs/*project*/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/*username*/.virtualenvs/*project*/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/*username*/.virtualenvs/*project*/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/*username*/<project>/app.py", line 49, in upload
ytube = YouTube(url)
File "/home/*username*/.virtualenvs/*project*/local/lib/python2.7/site-packages/pytube/api.py", line 66, in init
self.from_url(url)
File "/home/*username*/.virtualenvs/*project*/local/lib/python2.7/site-packages/pytube/api.py", line 158, in from_url
video_data = self.get_video_data()
File "/home/*username*/.virtualenvs/*project*/local/lib/python2.7/site-packages/pytube/api.py", line 254, in get_video_data
response = urlopen(self.url)
File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 422, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err) URLError: <urlopen error Tunnel connection failed: 403 Forbidden>