you-get icon indicating copy to clipboard operation
you-get copied to clipboard

Can't download YouTube live videos

Open toorich opened this issue 3 years ago • 5 comments

PS C:\WINDOWS\system32> you-get https://www.youtube.com/watch?v=UCG1aXVO8H8 --debug
[DEBUG] get_content: https://www.youtube.com/watch?v=UCG1aXVO8H8
you-get: version 0.4.1545, a tiny downloader that scrapes the web.
you-get: Namespace(URL=['https://www.youtube.com/watch?v=UCG1aXVO8H8'], auto_rename=False, cookies=None, debug=True, extractor_proxy=None, first=None, force=False, format=None, help=False, http_proxy=None, info=False, input_file=None, insecure=False, itag=None, json=False, last=None, no_caption=False, no_merge=False, no_proxy=False, output_dir='.', output_filename=None, password=None, player=None, playlist=False, size=None, skip_existing_file_size_check=False, socks_proxy=None, stream=None, timeout=600, url=False, version=False)
Traceback (most recent call last):
  File "e:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "e:\program files\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "E:\Program Files\Python37\Scripts\you-get.exe\__main__.py", line 7, in <module>
  File "e:\program files\python37\lib\site-packages\you_get\__main__.py", line 92, in main
    main(**kwargs)
  File "e:\program files\python37\lib\site-packages\you_get\common.py", line 1831, in main
    script_main(any_download, any_download_playlist, **kwargs)
  File "e:\program files\python37\lib\site-packages\you_get\common.py", line 1719, in script_main
    **extra
  File "e:\program files\python37\lib\site-packages\you_get\common.py", line 1345, in download_main
    download(url, **kwargs)
  File "e:\program files\python37\lib\site-packages\you_get\common.py", line 1822, in any_download
    m.download(url, **kwargs)
  File "e:\program files\python37\lib\site-packages\you_get\extractor.py", line 48, in download_by_url
    self.prepare(**kwargs)
  File "e:\program files\python37\lib\site-packages\you_get\extractors\youtube.py", line 269, in prepare
    stream_list = ytInitialPlayerResponse['streamingData']['formats']
KeyError: 'formats'

toorich avatar Oct 13 '21 19:10 toorich

Hello @toorich, Thanks for the Pull Request. We :heart: our contributors! Please wait for one of our human maintainers to review your patches. This may take a few days to weeks. Also, please understand that although your Pull Request may or may not be eventually merged, we value all contributions equally.

祝您健康!

soimort-bot avatar Oct 13 '21 19:10 soimort-bot

The problem is that they changed the name, now there are no formats anywhere, this name has changed to adaptiveFormats

image

leirons avatar May 20 '22 19:05 leirons

The problem is that they changed the name, now there are no formats anywhere, this name has changed to adaptiveFormats

image

I tried to change "formats" to "adaptiveFormats" in https://github.com/soimort/you-get/blob/develop/src/you_get/extractors/youtube.py (like line 242) , but when I run it, you-get returns an empty itag list.

toorich avatar Mar 23 '23 03:03 toorich

$ you-get --debug https://www.youtube.com/watch?v=OMq9he-5HUU

[DEBUG] get_content: https://www.youtube.com/watch?v=OMq9he-5HUU you-get: version 0.4.1650, a tiny downloader that scrapes the web. you-get: Namespace(version=False, help=False, info=False, url=False, json=False, no_merge=False, no_caption=False, postfix=False, force=False, skip_existing_file_size_check=False, format=None, output_filename=None, output_dir='.', player=None, cookies=None, timeout=600, debug=True, input_file=None, password=None, playlist=False, first=None, last=None, size=None, auto_rename=False, insecure=False, http_proxy=None, extractor_proxy=None, no_proxy=False, socks_proxy=None, stream=None, itag=None, m3u8=False, URL=['https://www.youtube.com/watch?v=OMq9he-5HUU']) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1038, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 976, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1448, in connect super().connect() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 942, in connect self.sock = self._create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 851, in create_connection raise exceptions[0] File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 836, in create_connection sock.connect(sa) TimeoutError: [Errno 60] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/bin/you-get", line 8, in sys.exit(main()) ^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/main.py", line 92, in main main(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 1870, in main script_main(any_download, any_download_playlist, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 1762, in script_main download_main( File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 1382, in download_main download(url, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 1861, in any_download m.download(url, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/extractor.py", line 48, in download_by_url self.prepare(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/extractors/youtube.py", line 263, in prepare video_page = get_content('https://www.youtube.com/watch?v=%s' % self.vid) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 477, in get_content response = urlopen_with_retry(req) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 437, in urlopen_with_retry return request.urlopen(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 519, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 496, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 60] Operation timed out>

eason1478 avatar May 26 '23 02:05 eason1478

The problem is that they changed the name, now there are no formats anywhere, this name has changed to adaptiveFormats image

I tried to change "formats" to "adaptiveFormats" in https://github.com/soimort/you-get/blob/develop/src/you_get/extractors/youtube.py (like line 242) , but when I run it, you-get returns an empty itag list.

I found another bug: $ you-get --debug https://www.youtube.com/watch?v=OMq9he-5HUU

[DEBUG] get_content: https://www.youtube.com/watch?v=OMq9he-5HUU you-get: version 0.4.1650, a tiny downloader that scrapes the web. you-get: Namespace(version=False, help=False, info=False, url=False, json=False, no_merge=False, no_caption=False, postfix=False, force=False, skip_existing_file_size_check=False, format=None, output_filename=None, output_dir='.', player=None, cookies=None, timeout=600, debug=True, input_file=None, password=None, playlist=False, first=None, last=None, size=None, auto_rename=False, insecure=False, http_proxy=None, extractor_proxy=None, no_proxy=False, socks_proxy=None, stream=None, itag=None, m3u8=False, URL=['https://www.youtube.com/watch?v=OMq9he-5HUU']) Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1348, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1329, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1278, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1038, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 976, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1448, in connect super().connect() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 942, in connect self.sock = self._create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 851, in create_connection raise exceptions[0] File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 836, in create_connection sock.connect(sa) TimeoutError: [Errno 60] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/bin/you-get", line 8, in sys.exit(main()) ^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/main.py", line 92, in main main(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 1870, in main script_main(any_download, any_download_playlist, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 1762, in script_main download_main( File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 1382, in download_main download(url, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 1861, in any_download m.download(url, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/extractor.py", line 48, in download_by_url self.prepare(**kwargs) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/extractors/youtube.py", line 263, in prepare video_page = get_content('https://www.youtube.com/watch?v=%s' % self.vid) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 477, in get_content response = urlopen_with_retry(req) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/you_get/common.py", line 437, in urlopen_with_retry return request.urlopen(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 216, in urlopen return opener.open(url, data, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 519, in open response = self._open(req, data) ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 536, in _open result = self._call_chain(self.handle_open, protocol, protocol + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 496, in _call_chain result = func(*args) ^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1391, in https_open return self.do_open(http.client.HTTPSConnection, req, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/urllib/request.py", line 1351, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 60] Operation timed out>

eason1478 avatar May 26 '23 02:05 eason1478