HFrost0 / bilix

⚡️Lightning-fast async download tool for bilibili and more
Apache License 2.0
1.58k stars 165 forks source link

0.18.6 regression test failure #205

Closed chenrui333 closed 5 months ago

chenrui333 commented 5 months ago

👋 trying to build the latest release, but run into some regression test failure. The error log is as below:

regression test failure log ``` ==> /usr/local/Cellar/bilix/0.18.6/bin/bilix info https://www.bilibili.com/video/av20203945/ INFO Directory videos not exists, auto created Traceback (most recent call last): File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/download/utils.py", line 90, in wrapped return await func(client, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/api.py", line 400, in get_video_info return await _get_video_info_from_html(client, url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/api.py", line 410, in _get_video_info_from_html video_info = VideoInfo.parse_html(url, res.text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/api.py", line 377, in parse_html dash = Dash.from_dict(play_info) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/api.py", line 233, in from_dict m = Media(quality=quality, codec=d['codecs'], **d) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/pydantic/main.py", line 164, in __init__ __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__) pydantic_core._pydantic_core.ValidationError: 1 validation error for Media backup_url Input should be a valid list [type=list_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.5/v/list_type The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/Cellar/bilix/0.18.6/bin/bilix", line 8, in sys.exit(main()) ^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/click/core.py", line 11[57](https://github.com/Homebrew/homebrew-core/actions/runs/7602439439/job/20704707136?pr=160541#step:3:58), in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/cli/main.py", line 374, in main loop.run_until_complete(cor) File "/usr/local/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line [68](https://github.com/Homebrew/homebrew-core/actions/runs/7602439439/job/20704707136?pr=160541#step:3:69)4, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/informer.py", line [88](https://github.com/Homebrew/homebrew-core/actions/runs/7602439439/job/20704707136?pr=160541#step:3:89), in temp await informer.info_key(key) File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/informer.py", line 23, in info_key await self.parse_url(key)(self, key) File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/informer.py", line 36, in info_video video_info = await api.get_video_info(self.client, url) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/download/utils.py", line [94](https://github.com/Homebrew/homebrew-core/actions/runs/7602439439/job/20704707136?pr=160541#step:3:95), in wrapped raise APIParseError(e, func) from e bilix.exception.APIParseError: APIParseError Caused by ValidationError in Error: bilix: failed ```

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/7602439439/job/20704707136?pr=160541 relates to Homebrew/homebrew-core#160541

HFrost0 commented 5 months ago

Unable to reproduce in local, it looks like the CI network environment may not be able to get the backup_url. We can remove the site api test like bilix info 'https://www.bilibili.com/xxx' temporarily.

chenrui333 commented 5 months ago

which python version are you using?

chenrui333 commented 5 months ago

I can reproduce it in my local

==> Testing bilix
/opt/homebrew/Library/Homebrew/test.rb (Formulary::FromPathLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/b/bilix.rb
==> /opt/homebrew/Cellar/bilix/0.18.6/bin/bilix info https://www.bilibili.com/video/av20203945/
INFO     Directory videos not exists, auto created

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/download/utils.py", line 90, in wrapped
    return await func(client, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/api.py", line 400, in get_video_info
    return await _get_video_info_from_html(client, url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/api.py", line 410, in _get_video_info_from_html
    video_info = VideoInfo.parse_html(url, res.text)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/api.py", line 377, in parse_html
    dash = Dash.from_dict(play_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/api.py", line 233, in from_dict
    m = Media(quality=quality, codec=d['codecs'], **d)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/pydantic/main.py", line 164, in __init__
    __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Media
backup_url
  Input should be a valid list [type=list_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.5/v/list_type

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/bilix/0.18.6/bin/bilix", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/cli/main.py", line 374, in main
    loop.run_until_complete(cor)
  File "/opt/homebrew/Cellar/python@3.12/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 684, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/informer.py", line 88, in temp
    await informer.info_key(key)
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/informer.py", line 23, in info_key
    await self.parse_url(key)(self, key)
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/sites/bilibili/informer.py", line 36, in info_video
    video_info = await api.get_video_info(self.client, url)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/bilix/0.18.6/libexec/lib/python3.12/site-packages/bilix/download/utils.py", line 94, in wrapped
    raise APIParseError(e, func) from e
bilix.exception.APIParseError: APIParseError Caused by ValidationError in <bilix.sites.bilibili.api:get_video_info>
HFrost0 commented 5 months ago

In some area(overseas), backup_url is unavailable so the pydanticV2 validation failed. I believe it's not related to python version(I tried 3.12 and 3.11). Can you try the master branch? I made some properties optional so it should pass the validation.

chenrui333 commented 5 months ago

I will do the master branch test later.

chenrui333 commented 5 months ago

@HFrost0 the build patch works for me, closing the issue now.