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

今天youtube下载报错了 #3031

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

silverx32
Copy link

Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Scripts\you-get.exe_main
.py", line 7, in
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get_main
.py", line 92, in main
main(**kwargs)
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get\common.py", line 1883, in main
script_main(any_download, any_download_playlist, **kwargs)
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get\common.py", line 1772, in script_main
download_main(
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get\common.py", line 1386, in download_main
download(url, **kwargs)
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get\common.py", line 1874, in any_download
m.download(url, **kwargs)
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get\extractor.py", line 48, in download_by_url
self.prepare(**kwargs)
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get\extractors\youtube.py", line 252, in prepare
url = self.class.dethrottle(self.js, url)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get\extractors\youtube.py", line 91, in dethrottle
n = n_to_n(js, qs['n'][0])
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\site-packages\you_get\extractors\youtube.py", line 85, in n_to_n
f1def = match1(js, r'\W%s=(function(\w+).+?)});' % re.escape(f1))
^^^^^^^^^^^^^
File "C:\Users\buyan\AppData\Local\Programs\Python\Python312\Lib\re_init_.py", line 262, in escape
pattern = str(pattern, 'latin1')
^^^^^^^^^^^^^^^^^^^^^^
TypeError: decoding to str: need a bytes-like object, NoneType found

@xiongyw
Copy link

xiongyw commented Oct 11, 2024

I encounted the same:

(base) bruin@cl210x ~/work/tmp $ python3
Python 3.11.7 (main, Dec 15 2023, 18:12:31) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
(base) bruin@cl210x ~/work/tmp $ you-get --debug https://www.youtube.com/watch?v=LB8tnR1wLAA&ab_channel=TheHobbyMachinistNZ
[1] 4152447
(base) bruin@cl210x ~/work/tmp $ [DEBUG] Extracting from the video page...
[DEBUG] get_content: https://www.youtube.com/watch?v=LB8tnR1wLAA
[DEBUG] Retrieving the player code...
[DEBUG] get_content: https://www.youtube.com/s/player/2f238d39/player-plasma-ias-phone-en_US.vflset/base.js
[DEBUG] Loading ytInitialPlayerResponse...
[DEBUG] status: OK
[DEBUG] Found format: itag=18
you-get: version 0.4.1730, 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, prefix=None, 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=LB8tnR1wLAA'])
Traceback (most recent call last):
  File "/home/bruin/anaconda3/bin/you-get", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/__main__.py", line 92, in main
    main(**kwargs)
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/common.py", line 1883, in main
    script_main(any_download, any_download_playlist, **kwargs)
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/common.py", line 1772, in script_main
    download_main(
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/common.py", line 1386, in download_main
    download(url, **kwargs)
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/common.py", line 1874, in any_download
    m.download(url, **kwargs)
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/extractor.py", line 48, in download_by_url
    self.prepare(**kwargs)
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/extractors/youtube.py", line 252, in prepare
    url = self.__class__.dethrottle(self.js, url)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/extractors/youtube.py", line 91, in dethrottle
    n = n_to_n(js, qs['n'][0])
        ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bruin/anaconda3/lib/python3.11/site-packages/you_get/extractors/youtube.py", line 85, in n_to_n
    f1def = match1(js, r'\W%s=(function\(\w+\).+?\)});' % re.escape(f1))
                                                          ^^^^^^^^^^^^^
  File "/home/bruin/anaconda3/lib/python3.11/re/__init__.py", line 260, in escape
    pattern = str(pattern, 'latin1')
              ^^^^^^^^^^^^^^^^^^^^^^
TypeError: decoding to str: need a bytes-like object, NoneType found

[1]+  Exit 1                  you-get --debug https://www.youtube.com/watch?v=LB8tnR1wLAA

@Chengym2023
Copy link

image
借个楼,谁能告诉这是怎么回事,卡了十几分钟,去B站这么慢的吗?
而且开代理才能下载B站的视频,还有这种反向代理操作也是第一次遇到..

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

Successfully merging this pull request may close these issues.

3 participants