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

Updated bilibili extractor to support new site code parsing #3003

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

doublevanos
Copy link

Code now support new bilibili site when using cookies with login. Seems like site code was updated recently.

@soimort-bot
Copy link
Collaborator

Hello @doublevanos,
Thanks for the Pull Request. We ❤️ 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.

祝您健康!

@skisqibao
Copy link

没有issue,借一下楼。
老哥,你们的抖音视频还能下载吗

@exoticknight
Copy link

Using cookies on bilibili will indeed cause JSON-related errors. I hope this PR can be merged quickly, or can I help with any testing?

Traceback (most recent call last):
  File "/usr/local/bin/you-get", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/you_get/__main__.py", line 92, in main
    main(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1870, in main
    script_main(any_download, any_download_playlist, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1762, in script_main
    download_main(
  File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1382, in download_main
    download(url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1861, in any_download
    m.download(url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/extractor.py", line 48, in download_by_url
    self.prepare(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/extractors/bilibili.py", line 211, in prepare
    initial_state = json.loads(initial_state_text)
  File "/usr/local/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

@flyingicedragon
Copy link

flyingicedragon commented Mar 16, 2023

Using cookies on bilibili will indeed cause JSON-related errors. I hope this PR can be merged quickly, or can I help with any testing?

Traceback (most recent call last):
  File "/usr/local/bin/you-get", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/you_get/__main__.py", line 92, in main
    main(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1870, in main
    script_main(any_download, any_download_playlist, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1762, in script_main
    download_main(
  File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1382, in download_main
    download(url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1861, in any_download
    m.download(url, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/extractor.py", line 48, in download_by_url
    self.prepare(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/you_get/extractors/bilibili.py", line 211, in prepare
    initial_state = json.loads(initial_state_text)
  File "/usr/local/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

yt-dlp works well for me with argument --cookies-from-browser firefox. Maybe you can try that.

yt-dlp

@flyingicedragon
Copy link

没有issue,借一下楼。 老哥,你们的抖音视频还能下载吗

I can't use you-get to download videos in ixigua and toutiao for a long time. I think problem for douyin maybe same.

@exoticknight
Copy link

Using cookies on bilibili will indeed cause JSON-related errors. I hope this PR can be merged quickly, or can I help with any testing?

Traceback (most recent call last):

File "/usr/local/bin/you-get", line 8, in

sys.exit(main())

File "/usr/local/lib/python3.10/site-packages/you_get/main.py", line 92, in main

main(**kwargs)

File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1870, in main

script_main(any_download, any_download_playlist, **kwargs)

File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1762, in script_main

download_main(

File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1382, in download_main

download(url, **kwargs)

File "/usr/local/lib/python3.10/site-packages/you_get/common.py", line 1861, in any_download

m.download(url, **kwargs)

File "/usr/local/lib/python3.10/site-packages/you_get/extractor.py", line 48, in download_by_url

self.prepare(**kwargs)

File "/usr/local/lib/python3.10/site-packages/you_get/extractors/bilibili.py", line 211, in prepare

initial_state = json.loads(initial_state_text)

File "/usr/local/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/init.py", line 339, in loads

raise TypeError(f'the JSON object must be str, bytes or bytearray, '

TypeError: the JSON object must be str, bytes or bytearray, not NoneType

yt-dlp works well for me with argument --cookies-from-browser firefox. Maybe you can try that.

yt-dlp

thx for sharing! I will give it a try!

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