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站的视频,还有这种反向代理操作也是第一次遇到..

@KAHO-TONG
Copy link

I have the same problem when I download videos from Youtube.

@DGideas
Copy link
Contributor

DGideas commented Oct 13, 2024

估计和这个问题一样,需要修改一下 YouTube 默认的 itag,yt-dlp/yt-dlp#11154

It seems that same to this issue, we need to change the logic when selecting the default itag, itag=18 is deprecated

@BanVaveLor
Copy link

借个楼

在下载UP主空间视频时,会出现以下错误。

此问题从2023年5月开始,目前仍然存在。

以下为输出信息。

C:\Users\BanVaveLor>you-get -l -d --cookies=G:\文件\cookies.sqlite -o=H:\新建文件夹 https://space.bilibili.com/2948981/video
[DEBUG] get_content: https://space.bilibili.com/2948981/video
[DEBUG] get_content: https://api.bilibili.com/x/space/arc/search?mid=2948981&pn=1&ps=50&tid=0&keyword=&order=pubdate&jsonp=jsonp
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='H:\\新建文件夹', player=None, cookies='G:\\文 件\\cookies.sqlite', timeout=600, debug=True, input_file=None, password=None, playlist=True, 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://space.bilibili.com/2948981/video'])
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "c:\program files\python311\scripts\you-get.exe\__main__.py", line 7, in <module>
  File "C:\Program Files\Python311\Lib\site-packages\you_get\__main__.py", line 92, in main
    main(**kwargs)
  File "C:\Program Files\Python311\Lib\site-packages\you_get\common.py", line 1883, in main
    script_main(any_download, any_download_playlist, **kwargs)
  File "C:\Program Files\Python311\Lib\site-packages\you_get\common.py", line 1772, in script_main
    download_main(
  File "C:\Program Files\Python311\Lib\site-packages\you_get\common.py", line 1384, in download_main
    download_playlist(url, **kwargs)
  File "C:\Program Files\Python311\Lib\site-packages\you_get\common.py", line 1879, in any_download_playlist
    m.download_playlist(url, **kwargs)
  File "C:\Program Files\Python311\Lib\site-packages\you_get\extractors\bilibili.py", line 823, in download_playlist_by_url
    pc = math.ceil(videos_info['data']['page']['count'] / videos_info['data']['page']['ps'])
                   ~~~~~~~~~~~^^^^^^^^
KeyError: 'data'

请帮帮我!

@DGideas
Copy link
Contributor

DGideas commented Oct 20, 2024 via email

@BanVaveLor
Copy link

BanVaveLor commented Oct 20, 2024 via email

@DGideas
Copy link
Contributor

DGideas commented Oct 20, 2024 via email

@BanVaveLor
Copy link

BanVaveLor commented Oct 20, 2024 via email

@DGideas
Copy link
Contributor

DGideas commented Oct 21, 2024 via email

@BanVaveLor
Copy link

BanVaveLor commented Oct 21, 2024 via email

@DGideas
Copy link
Contributor

DGideas commented Oct 21, 2024 via email

@tuta-gh
Copy link

tuta-gh commented Oct 21, 2024

you-get 'https://www.youtube.com/shorts/38J29uKswB4?feature=share' --debug [DEBUG] Extracting from the video page... [DEBUG] get_content: https://www.youtube.com/watch?v=38J29uKswB4 [DEBUG] Retrieving the player code... [DEBUG] get_content: https://www.youtube.com/s/player/e627e516/player-plasma-ias-phone-en_US.vflset/base.js [DEBUG] Loading ytInitialPlayerResponse... [DEBUG] status: OK [DEBUG] Found format: itag=18 [DEBUG] Parsing signatureCipher for 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/shorts/38J29uKswB4?feature=share']) Traceback (most recent call last): File "/usr/local/bin/you-get", line 8, in <module> sys.exit(main()) ^^^^^^ File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/site-packages/you_get/__main__.py", line 92, in main main(**kwargs) File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/site-packages/you_get/common.py", line 1883, in main script_main(any_download, any_download_playlist, **kwargs) File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/site-packages/you_get/common.py", line 1772, in script_main download_main( File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/site-packages/you_get/common.py", line 1386, in download_main download(url, **kwargs) File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/site-packages/you_get/common.py", line 1874, in any_download m.download(url, **kwargs) File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/site-packages/you_get/extractor.py", line 48, in download_by_url self.prepare(**kwargs) File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/site-packages/you_get/extractors/youtube.py", line 252, in prepare url = self.__class__.dethrottle(self.js, url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/site-packages/you_get/extractors/youtube.py", line 91, in dethrottle n = n_to_n(js, qs['n'][0]) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/you-get/0.4.1730/libexec/lib/python3.12/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 "/usr/local/Cellar/[email protected]/3.12.7_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/re/__init__.py", line 262, in escape pattern = str(pattern, 'latin1') ^^^^^^^^^^^^^^^^^^^^^^ TypeError: decoding to str: need a bytes-like object, NoneType found
The similar issue on youtube

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.

7 participants