SeaHOH / ykdl

a video downloader focus on China mainland video sites.
https://github.com/zhangn1985/ykdl
Other
1.42k stars 285 forks source link

抖音视频失效 #628

Closed CJN1986 closed 9 months ago

CJN1986 commented 10 months ago

在提交前,请确保您已经检查了以下内容!

请将错误输出粘贴在下面:

视频:

ykdl -i https://www.douyin.com/video/7274905104250096952 --debug
DEBUG:ykdl.util.http:Add <urllib.request.HTTPSHandler object at 0x7f1fbd6ded90> to default handlers
DEBUG:ykdl.util.http:Add <urllib.request.ProxyHandler object at 0x7f1fbd6de4f0> to default handlers
DEBUG:ykdl.common:host> www.douyin.com
DEBUG:ykdl.common:short_name> douyin
DEBUG:抖音 (Douyin):media ID: 7274905104250096952
DEBUG:ykdl.util.http:get_response> URL: https://www.iesdouyin.com/aweme/v1/web/aweme/detail/?aweme_id=7274905104250096952
DEBUG:YKDL:HTTP Error 403: Forbidden
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/cykdl/__main__.py", line 318, in main
    for rc in map(handle_video, args.video_urls):
  File "/usr/local/lib/python3.8/dist-packages/cykdl/__main__.py", line 227, in handle_video
    info = parser(u)
  File "/usr/local/lib/python3.8/dist-packages/ykdl/extractor.py", line 81, in parser
    info = self.prepare()
  File "/usr/local/lib/python3.8/dist-packages/ykdl/extractors/douyin/video.py", line 15, in prepare
    data = get_response('https://www.iesdouyin.com/aweme/v1/web/aweme/detail/',
  File "/usr/local/lib/python3.8/dist-packages/ykdl/util/http.py", line 632, in get_response
    response = _opener_open_cached(req, encoding)
  File "/usr/local/lib/python3.8/dist-packages/ykdl/util/http.py", line 403, in _opener_open
    response = HTTPResponse(req, _opener.open(req), encoding)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

直播:

ykdl -i https://live.douyin.com/262685353314 --debug
DEBUG:ykdl.util.http:Add <urllib.request.HTTPSHandler object at 0x7ff5017afd90> to default handlers
DEBUG:ykdl.util.http:Add <urllib.request.ProxyHandler object at 0x7ff5017af4f0> to default handlers
DEBUG:ykdl.common:host> live.douyin.com
DEBUG:ykdl.common:short_name> douyin
DEBUG:ykdl.util.http:get_response> URL: https://live.douyin.com/262685353314
DEBUG:YKDL:argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/cykdl/__main__.py", line 318, in main
    for rc in map(handle_video, args.video_urls):
  File "/usr/local/lib/python3.8/dist-packages/cykdl/__main__.py", line 227, in handle_video
    info = parser(u)
  File "/usr/local/lib/python3.8/dist-packages/ykdl/extractor.py", line 81, in parser
    info = self.prepare()
  File "/usr/local/lib/python3.8/dist-packages/ykdl/extractors/douyin/live.py", line 39, in prepare
    data = json.loads(unquote(data))
  File "/usr/lib/python3.8/urllib/parse.py", line 656, in unquote
    if '%' not in string:
TypeError: argument of type 'NoneType' is not iterable

如果你有其他附言,例如问题只在某个视频发生,或者是一般性讨论或者提出新功能,请在下面添加:

YKDL 1.8.2,好像是最近几天开始看不了。

SeaHOH commented 10 months ago

直播已修复。 视频搞不来,byted_acrawler.sign 和浏览器算出来的长度不一样。

CJN1986 commented 10 months ago

修复直播就可以了,因为直播看不了,才顺便试一下视频能不能看。

SeaHOH commented 10 months ago

先这样留着吧,毕竟 sign 的问题没有解决,说不定以后直播也需要。

CJN1986 commented 10 months ago

直播好像又不行了。

ykdl -p mpv.exe https://live.douyin.com/660292215268 --debug
DEBUG:ykdl.util.http:Add <urllib.request.HTTPSHandler object at 0x000002917CE616D0> to default handlers
DEBUG:ykdl.util.http:Add <urllib.request.ProxyHandler object at 0x000002917CE615E0> to default handlers
DEBUG:ykdl.common:host> live.douyin.com
DEBUG:ykdl.common:short_name> douyin
DEBUG:ykdl.util.http:get_response> URL: https://live.douyin.com/660292215268
DEBUG:抖音直播 (Douyin):data:
e:I{"id":"78161","chunks":[6021,8904,7203,7317],"name":"","async":false}
5:["$","$Le",null,{"pathname":"/660292215268","isClient":false,"os":{"os":"Linux","version":"","isMas":false},"isMainland":true}]

DEBUG:YKDL:'int' object is not subscriptable
Traceback (most recent call last):
  File "C:\Users\use\AppData\Roaming\Python\Python39\site-packages\cykdl\__main__.py", line 318, in main
    for rc in map(handle_video, args.video_urls):
  File "C:\Users\use\AppData\Roaming\Python\Python39\site-packages\cykdl\__main__.py", line 227, in handle_video
    info = parser(u)
  File "C:\Users\use\AppData\Roaming\Python\Python39\site-packages\ykdl\extractor.py", line 81, in parser
    info = self.prepare()
  File "C:\Users\use\AppData\Roaming\Python\Python39\site-packages\ykdl\extractors\douyin\live.py", line 42, in prepare
    video_info = data['state']['roomStore']['roomInfo'].get('room')
TypeError: 'int' object is not subscriptable
SeaHOH commented 10 months ago

好了,短期内可能还会有修正。

SeaHOH commented 9 months ago

昨天才想起来几个月前试过的 X-Bogus,当时不添加也行。

CJN1986 commented 9 months ago

更新后反而看不了

ykdl -i https://live.douyin.com/208823316033 --debug

DEBUG:ykdl.util.http:Add <urllib.request.HTTPSHandler object at 0x00000209225316D0> to default handlers
DEBUG:ykdl.util.http:Add <urllib.request.ProxyHandler object at 0x00000209225315E0> to default handlers
DEBUG:ykdl.common:host> live.douyin.com
DEBUG:ykdl.common:short_name> douyin
DEBUG:YKDL:get_nonce_cookies() takes 0 positional arguments but 1 was given
Traceback (most recent call last):
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\cykdl\__main__.py", line 318, in main
    for rc in map(handle_video, args.video_urls):
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\cykdl\__main__.py", line 227, in handle_video
    info = parser(u)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\ykdl\extractor.py", line 81, in parser
    info = self.prepare()
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\ykdl\extractors\douyin\live.py", line 35, in prepare
    html = _byted.get_content(self.url)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\ykdl\extractors\_byted.py", line 100, in get_content
    response = get_response(*args, **kwargs)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\ykdl\extractors\_byted.py", line 93, in get_response
    cookies = _cookies.get('nonce') or get_nonce_cookies(url)
TypeError: get_nonce_cookies() takes 0 positional arguments but 1 was given

回退到e72165baed8b7e6a8bccfb8d60de9341fc4f7db6这个版本就可以看直播