Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib.error.HTTPError: HTTP Error 410: Gone #1

Closed
pedrofale opened this issue Sep 16, 2024 · 2 comments
Closed

urllib.error.HTTPError: HTTP Error 410: Gone #1

pedrofale opened this issue Sep 16, 2024 · 2 comments

Comments

@pedrofale
Copy link

pedrofale commented Sep 16, 2024

Thanks for the great tool! I am having trouble running it, though. In my attempt to reproduce the example in https://kpj.github.io/my_projects/clypper.html, I am getting HTTP Error 410: Gone from the urlib module. Here's the full output:

$ cat innocent.txt
https://www.youtube.com/watch?v=-tvA3Ezqjl8 12:32 12:34.7
https://www.youtube.com/watch?v=dQw4w9WgXcQ 00:42 00:43.1
$ clypper -i innocent.txt -o ohno.mp4
Processing clips:   0%|                                                                                                                                                                                                                                 | 0/2 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/Users/pedrof/miniconda3/bin/clypper", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/clypper/cli.py", line 22, in main
    handle(input_file, output_file, Path(temp_dir))
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/clypper/clypper.py", line 74, in handle
    vid.load()
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/clypper/video_sources.py", line 115, in load
    self.yt = YouTube(self.url)
              ^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/pytube/__main__.py", line 91, in __init__
    self.prefetch()
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/pytube/__main__.py", line 181, in prefetch
    self.vid_info_raw = request.get(self.vid_info_url)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/pytube/request.py", line 36, in get
    return _execute_request(url).read().decode("utf-8")
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/site-packages/pytube/request.py", line 24, in _execute_request
    return urlopen(request)  # nosec
           ^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 553, in error
    result = self._call_chain(*args)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 745, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 559, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/Users/pedrof/miniconda3/lib/python3.12/urllib/request.py", line 639, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 410: Gone

The two youtube urls definitely exist, though.

@kpj
Copy link
Owner

kpj commented Sep 17, 2024

Thanks a lot for reporting this issue!

This is apparently an issue with the pytube3 package (get-pytube/pytube3#121).
To fix this, I switched to the pytube package.

This however leads to the error urllib.error.HTTPError: HTTP Error 400: Bad Request.
Which could be fixed by using pytubefix instead.

As I updated the dependencies, this now leads to the error AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' in the package moviepy.
But that could be fixed by adding the opencv-python dependency.

After this fun debugging trip, I was able to create the output video.
Can you reinstall (from GitHub) and test if it also works for you?

@pedrofale
Copy link
Author

I created a fresh conda environment and managed to install the package. After also installing ffmpeg and imagemagick, I could run clypper and create the output video. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants