pytube: [BUG] HTTP Error 410: Gone

Before creating an issue

Please confirm that you are on the latest version of pytube by installing from the source. You can do this by running python -m pip install git+https://github.com/pytube/pytube. Sometimes, the pypi library repository is not up to date, and your issue may have been fixed already!

I install in a new conda environment

Describe the bug I am new this open source project. I running this project in a conda environment. I doing the quickstart project. I receive a urllib.error.HTTPError: HTTP Error 410: Gone

To Reproduce Please provide the following information:

  • The video or playlist url that is causing the error.
  • The code where the problem is occurring.

Expected behavior A clear and concise description of what you expected to happen.

Output File “<stdin>”, line 1, in <module> File “C:\ProgramData\Miniconda3\lib\site-packages\pytube_main_.py”, line 321, in streams return StreamQuery(self.fmt_streams) File “C:\ProgramData\Miniconda3\lib\site-packages\pytube_main_.py”, line 214, in fmt_streams if “adaptive_fmts” in self.player_config_args: File “C:\ProgramData\Miniconda3\lib\site-packages\pytube_main_.py”, line 188, in player_config_args self.player_config_args = self.vid_info File "C:\ProgramData\Miniconda3\lib\site-packages\pytube_main.py", line 291, in vid_info return dict(parse_qsl(self.vid_info_raw)) File “C:\ProgramData\Miniconda3\lib\site-packages\pytube_main_.py”, line 109, in vid_info_raw self._vid_info_raw = request.get(self.vid_info_url) File “C:\ProgramData\Miniconda3\lib\site-packages\pytube\request.py”, line 53, in get response = _execute_request(url, headers=extra_headers, timeout=timeout) File “C:\ProgramData\Miniconda3\lib\site-packages\pytube\request.py”, line 37, in _execute_request return urlopen(request, timeout=timeout) # nosec File “C:\ProgramData\Miniconda3\lib\urllib\request.py”, line 222, in urlopen return opener.open(url, data, timeout) File “C:\ProgramData\Miniconda3\lib\urllib\request.py”, line 531, in open response = meth(req, response) File “C:\ProgramData\Miniconda3\lib\urllib\request.py”, line 640, in http_response response = self.parent.error( File “C:\ProgramData\Miniconda3\lib\urllib\request.py”, line 569, in error return self._call_chain(*args) File “C:\ProgramData\Miniconda3\lib\urllib\request.py”, line 502, in _call_chain result = func(*args) File “C:\ProgramData\Miniconda3\lib\urllib\request.py”, line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 410: Gone

System information Please provide the following information:

  • 3.8.5
  • 10.9.3
  • Command used to install pytube

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 6
  • Comments: 33

Most upvoted comments

Can confirm, getting this as well on 3 different machines

The fix for this has been pushed to pypi as v11.0.0, so you should be able to install it normally with python -m pip install --upgrade pytube

I am getting the same issue with an old and the latest version. pip install pytube --upgrade

@tfdahlin I’m not sure what issue #1060 is entirely about but when you instantiate a YouTube object and provide a watch video URL, it computes a video info URL.

I did an interactive Python session to highlight what the vid_info_url looks like:

Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pytube import __version__
>>> print(__version__)
10.9.3
>>> from pytube import YouTube
>>> v=YouTube('https://www.youtube.com/watch?v=4NkFJwQ-WAA')
>>> print(v.vid_info_url)
https://www.youtube.com/get_video_info?video_id=4NkFJwQ-WAA&ps=default&eurl=https%253A%2F%2Fyoutube.com%2Fwatch%253Fv%253D4NkFJwQ-WAA&hl=en_US&html5=1&c=TVHTML5&cver=7.20201028
>>> 

When you paste that URL into a browser you do get the HTTP 410 Gone status code as shown below.

image

As soon as you try and reach out for any properties such as title, for example, it will call into vid_info_raw property which in turn tries to access the vid_info_url and that’s when you end up getting an HTTP 410, which is perhaps a touch stronger than a 404, meaning it’s intentionally permanently deleted.

>>> print(v.title)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\youtube_scraper\pytube\__main__.py", line 366, in title
    self._title = self.player_response['videoDetails']['title']
  File "C:\youtube_scraper\pytube\__main__.py", line 168, in player_response
    if isinstance(self.player_config_args["player_response"], str):
  File "C:\youtube_scraper\pytube\__main__.py", line 188, in player_config_args
    self._player_config_args = self.vid_info
  File "C:\youtube_scraper\pytube\__main__.py", line 291, in vid_info
    return dict(parse_qsl(self.vid_info_raw))
  File "C:\youtube_scraper\pytube\__main__.py", line 109, in vid_info_raw
    self._vid_info_raw = request.get(self.vid_info_url)
  File "C:\youtube_scraper\pytube\request.py", line 53, in get
    response = _execute_request(url, headers=extra_headers, timeout=timeout)
  File "C:\youtube_scraper\pytube\request.py", line 37, in _execute_request
    return urlopen(request, timeout=timeout)  # nosec
  File "c:\python38\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "c:\python38\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "c:\python38\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "c:\python38\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "c:\python38\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "c:\python38\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 410: Gone
>>>

So, this is a really tough problem and I myself was trying to call code to download the video. But to get the different streams information, it will still call into this vid_info_url endpoint and receive the 410 error code. So, it does not really get anywhere else.

Perhaps there is some alternate path for retrieving this information. Thanks for your hard work trying to maintain this library. I’ll watch this thread a bit and also try some more experimentation to see if I can find an alternate path for “video info”.

Just wanted to try and shed some light on this error that many of us seem to now be receiving due to changes on Google’s end of things.

I too am facing the same issue.

+1

Given your stack trace, you definitely do not have version 11.0.0 of pytube installed in the Python interpreter you are using, because it is referring to line numbers in pytube_main.py that no longer exist in version 11.0.0. I would open the version.py file in a text editor, to confirm that you are using an older version. Then follow with pip uninstall pytube and then pip install pytube and then open that version.py file again to confirm you have version 11.0.0 now installed.

Sent from my iPhone

On Aug 6, 2021, at 1:22 AM, olkar100 @.***> wrote:

Seem, that the video source changed something in the meantime or the fix did not fix the issue. With v11.0.0 installed via pip I get the error message below while trying to download https://www.youtube.com/watch?v=f738hQ2axes or any other video. I also tried to installed via python -m pip install git+https://github.com/pytube/pytube with the same result as the pytube version are identical at the moment.

Running on Python 3.9.6 64bit with individual packages installed via pip. Would be great if this bug would be re-opened and checked. Thanks a lot in advance!!

Traceback (most recent call last): File “c:<UsersPath>\Youtube_Downloader\main.py”, line 13, in print(video.title) File “C:<UsersPath>\Python\Python39\lib\site-packages\pytube_main_.py”, line 351, in title self.title = self.player_response[‘videoDetails’][‘title’] File “C:<UsersPath>\Python\Python39\lib\site-packages\pytube_main.py”, line 165, in player_response if isinstance(self.player_config_args[“player_response”], str): File “C:<UsersPath>\Python\Python39\lib\site-packages\pytube_main_.py”, line 185, in player_config_args self.player_config_args = self.vid_info File “C:<UsersPath>\Python\Python39\lib\site-packages\pytube_main.py”, line 278, in vid_info return dict(parse_qsl(self.vid_info_raw)) File “C:<UsersPath>\Python\Python39\lib\site-packages\pytube_main_.py”, line 106, in vid_info_raw self._vid_info_raw = request.get(self.vid_info_url) File “C:<UsersPath>\Python\Python39\lib\site-packages\pytube\request.py”, line 52, in get response = _execute_request(url, headers=extra_headers, timeout=timeout) File “C:\Python\Python39\lib\site-packages\pytube\request.py”, line 36, in _execute_request return urlopen(request, timeout=timeout) # nosec File “C:<UsersPath>\Python\Python39\lib\urllib\request.py”, line 214, in urlopen return opener.open(url, data, timeout) File “C:<UsersPath>\Python\Python39\lib\urllib\request.py”, line 523, in open response = meth(req, response) File “C:<UsersPath>\Python\Python39\lib\urllib\request.py”, line 632, in http_response response = self.parent.error( File “C:<UsersPath>\Python\Python39\lib\urllib\request.py”, line 561, in error return self._call_chain(*args) File “C:<UsersPath>\Python\Python39\lib\urllib\request.py”, line 494, in _call_chain result = func(*args) File “C:<UsersPath>\Python\Python39\lib\urllib\request.py”, line 641, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 410: Gone

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Thank you so much for your help. Appreciate the speed to resolution!

On Tue, Aug 3, 2021 at 6:11 PM Taylor Fox Dahlin @.***> wrote:

The fix for this has been pushed to pypi as v11.0.0, so you should be able to install it normally with python -m pip install --upgrade pytube

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pytube/pytube/issues/1076#issuecomment-892225315, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP5E7VEXHYACQDI67JGCIUDT3BZRLANCNFSM5BJLPCYQ .

– Kind regards, Eric

http://www.OneSourceRegulatory.com

| Eric Hauk Senior Developer | @.*** | +1 (847) 312-7598 | +1 (833) OSR-TEAM http://www.OneSourceRegulatory.com https://www.linkedin.com/company/onesource-regulatory/ https://www.youtube.com/channel/UCAHl8HLPFSkxFvqjGSeL-Tg/videos https://twitter.com/1SourceReg https://www.facebook.com/OneSourceRegulatory/ Solutions by OSR: http://www.MyIndago.com http://www.MyIndago.com https://www.linkedin.com/company/myindago-com/ https://www.youtube.com/channel/UCAHl8HLPFSkxFvqjGSeL-Tg/videos https://twitter.com/MyIndago?lang=en https://www.facebook.com/MyIndago/ Confidential Information This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify @.*** and then delete this email from your system. Forwarding or saving this information is strictly prohibited.

@LastFoxOne test the experimental branch and see if that fixes the problem for you: python -m pip install git+https://github.com/Zeecka/pytube@fix_1060

I have the same error code with a different project. The problem is with pytube because I could download the same video with pafy library , I hope you update and fix it pytube

@tfdahlin I’m not sure what issue #1060 is entirely about but when you instantiate a YouTube object and provide a watch video URL, it computes a video info URL.

I did an interactive Python session to highlight what the vid_info_url looks like: As soon as you try and reach out for any properties such as title, for example, it will call into vid_info_raw property which in turn tries to access the vid_info_url and that’s when you end up getting an HTTP 410, which is perhaps a touch stronger than a 404, meaning it’s intentionally permanently deleted.

Yeah, I’m pretty sure YouTube has just changed the error on that page from 404 to 410. If you install the experimental branch to solve the 404 issue with python -m pip install git+https://github.com/Zeecka/pytube@fix_1060, it should fix this problem as well. There are still a couple of kinks that I need to work out with that fix before I release it to pypi, but I believe most of the functionality works correctly.

I believe this issue is the same as #1060, and will be fixed by #1067

Thanks a lot for the advice - and of course you are right. The version.py file lists still 10.8.5. The culprit was on my side with pip updating still the 3.8.5. python version and not the 3.9. The only thing I need to figure out is how to change the default pip settings. Thanks a lot for helping to track down the issue. Very much appreciated.

@LastFoxOne if you dont have Git, then it seems you have problems beyond the scope of the issue.

I installed it, but it didn’t solve the main issue