2

Not sure what it is, but its been driving me nuts and im such a newbie I tried so many things but im not sure what it means, ive tried installing and reinstalling pytube but nothing changed.

Here's my code

from pytube import YouTube

link = input("Enter in a link: ")

video = YouTube(link)

print(video.title)

print(video.streams.filter(progressive=True))

stream = video.streams.get_by_itag(22)
stream.download()
print("Video downloaded")

The entire error message:

Traceback (most recent call last):
  - File "c:\PytubeDownloader\YoutubeDownloader2.py", line 5, in <module>
    video = YouTube(link)
  - File "C:\Python\lib\site-packages\pytube\__main__.py", line 91, in __init__
    self.prefetch()
  - File "C:\Python\lib\site-packages\pytube\__main__.py", line 181, in prefetch
    self.vid_info_raw = request.get(self.vid_info_url)
  - File "C:\Python\lib\site-packages\pytube\request.py", line 36, in get
    return _execute_request(url).read().decode("utf-8")
  - File "C:\Python\lib\site-packages\pytube\request.py", line 24, in _execute_request
    return urlopen(request)  # nosec
  - File "C:\Python\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  - File "C:\Python\lib\urllib\request.py", line 525, in open
    response = meth(req, response)
  - File "C:\Python\lib\urllib\request.py", line 634, in http_response
    response = self.parent.error(
  - File "C:\Python\lib\urllib\request.py", line 557, in error
    result = self._call_chain(*args)
  - File "C:\Python\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  - File "C:\Python\lib\urllib\request.py", line 749, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  - File "C:\Python\lib\urllib\request.py", line 525, in open
    response = meth(req, response)
  - File "C:\Python\lib\urllib\request.py", line 634, in http_response
    response = self.parent.error(
  - File "C:\Python\lib\urllib\request.py", line 563, in error
    return self._call_chain(*args)
  - File "C:\Python\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  - File "C:\Python\lib\urllib\request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 410: Gone

Ok so I did what was recommended in Pytube: urllib.error.HTTPError: HTTP Error 410: Gone and now im getting a completely different error

Traceback (most recent call last):

  • File "c:\PytubeDownloader\YoutubeDownloader2.py", line 9, in print(video.streams.filter(progressive=True))
  • File "C:\Python\lib\site-packages\pytube_main_.py", line 292, in streams return StreamQuery(self.fmt_streams)
  • File "C:\Python\lib\site-packages\pytube_main_.py", line 184, in fmt_streams extract.apply_signature(stream_manifest, self.vid_info, self.js)
  • File "C:\Python\lib\site-packages\pytube\extract.py", line 409, in apply_signature cipher = Cipher(js=js)
  • File "C:\Python\lib\site-packages\pytube\cipher.py", line 33, in init raise RegexMatchError(
  • pytube.exceptions.RegexMatchError: init: could not find match for ^\w+\W
meojax
  • 21
  • 4
  • 1
    Does this answer your question? [Pytube : urllib.error.HTTPError: HTTP Error 410: Gone](https://stackoverflow.com/questions/68680322/pytube-urllib-error-httperror-http-error-410-gone) – mkrieger1 Jan 21 '22 at 00:27
  • 1
    Seems to be a [bug with pytube](https://github.com/pytube/pytube/issues/1191) – Anon Coward Jan 21 '22 at 00:28
  • I have tried https://stackoverflow.com/questions/68680322/pytube-urllib-error-httperror-http-error-410-gone it seems to give me a new error after following instructions, I re-edited the post with the new error. – meojax Jan 21 '22 at 00:53
  • Problem solved, I followed https://stackoverflow.com/questions/70776558/pytube-exceptions-regexmatcherror-init-could-not-find-match-for-w-w – meojax Jan 21 '22 at 01:12
  • 1
    YouTube sometimes changes HTML content and then modules like `pytube` may need also changes to work with new HTML - and sometimes it needs to wait for new version with updates. – furas Jan 21 '22 at 08:09

1 Answers1

0

Experienced same error. In cipher.py replace the regexs in pattern in get_initial_function_name with: r'\bc\s*&&\s*d\.set\([^,]+\s*,\s*\([^)]*\)\s*\(\s*(?P<sig>[a-zA-Z0-9$]+)\('.

  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/31611505) – innicoder Apr 30 '22 at 02:03