-3

This is just simple Python code that worked when I first ran it, but didn't work the next day, even though I didn't change anything:

from pytube import YouTube
link = "https://www.youtube.com/watch?v=6_ardA6TuX0"
video = YouTube(link)
yt = video.streams.get_highest_resolution()
yt.download("Lieder")

I get this Error:

Traceback (most recent call last):
  File "C:\Users\edonj\OneDrive\Desktop\Spot\main.py", line 9, in <module>
    yt.download("Lieder")
  File "C:\Users\edonj\OneDrive\Desktop\Spot\venv\lib\site-packages\pytube\streams.py", line 252, in download
    for chunk in request.stream(
  File "C:\Users\edonj\OneDrive\Desktop\Spot\venv\lib\site-packages\pytube\request.py", line 185, in stream
    chunk = response.read()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 476, in read
    s = self._safe_read(self.length)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\http\client.py", line 628, in _safe_read
    raise IncompleteRead(b''.join(s), amt)
http.client.IncompleteRead: IncompleteRead(66612 bytes read, 9370572 more expected)
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Doni
  • 1
  • 4
    Welcome to Stack Overflow. If you are having difficulty with someone else's library, following their examples directly (or something simple worked before and now doesn't), then that is a tech support question. We do not provide tech support for libraries here. Please try the project's documentation, issue tracker etc. For example, I tried putting `pytube incompleteread` into a search engine and got [this](https://github.com/pytube/pytube/issues/1291) as the first result. – Karl Knechtel Jul 26 '22 at 21:36

1 Answers1

0

VideoUnavailable.

Proxy will help you.

  • What makes you think the video is unavailable or that this is a proxy/networking issue? – Jeremy Caney Aug 25 '22 at 20:26
  • Done it without any troubles with proxy: – Alekzander Aug 25 '22 at 21:13
  • from pytube.helpers import install_proxy proxy_handler1 = { "http": "XXX:XXX@212.192.38.218:11111", 'https': 'XXX:XXX@212.192.38.218:11111' } yt = YouTube('https://www.youtube.com/watch?v=6_ardA6TuX0') stream = yt.streams.get_highest_resolution()) stream.download(filename = f"{file}.mp4" ) – Alekzander Aug 25 '22 at 21:14
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 30 '22 at 09:39