HFrost0 / bilix

โšก๏ธLightning-fast async download tool for bilibili and more
Apache License 2.0
1.6k stars 166 forks source link

[homebrew] bilix 0.18.4 linux build failed to run #165

Closed chenrui333 closed 6 months ago

chenrui333 commented 1 year ago

๐Ÿ‘‹ while upgrading bilix to 0.18.4, I ran into some test run failure

==> /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/bin/bilix info https://www.bilibili.com/video/av20203945/
  INFO     Directory videos not exists, auto created                              

  Traceback (most recent call last):
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/bin/bilix", line 8, in <module>
      sys.exit(main())
               ^^^^^^
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
      return self.main(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/click/core.py", line 1078, in main
      rv = self.invoke(ctx)
           ^^^^^^^^^^^^^^^^
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
      return ctx.invoke(self.callback, **ctx.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/click/core.py", line 783, in invoke
      return __callback(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/bilix/cli/main.py", line 374, in main
      loop.run_until_complete(cor)
    File "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/asyncio/base_events.py", line 6[53](https://github.com/Homebrew/homebrew-core/actions/runs/5576975395/jobs/10189742481?pr=136811#step:4:54), in run_until_complete
      return future.result()
             ^^^^^^^^^^^^^^^
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/bilix/sites/bilibili/informer.py", line 88, in temp
      await informer.info_key(key)
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/bilix/sites/bilibili/informer.py", line 23, in info_key
      await self.parse_url(key)(self, key)
    File "/home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/bilix/sites/bilibili/informer.py", line 48, in info_video
      cors = [ensure_size(m) for m in dash.videos] + [ensure_size(m) for m in dash.audios]
                                      ^^^^^^^^^^^
  AttributeError: 'NoneType' object has no attribute 'videos'

relates to https://github.com/Homebrew/homebrew-core/pull/136811 full build log, https://github.com/Homebrew/homebrew-core/actions/runs/5576975395/jobs/10189742481

HFrost0 commented 1 year ago

I notice that bilix info https://www.bilibili.com/video/av20203945/ succeed in some platform. I believe this error is related to the network since bilibili API is not always available in Github Action. Can you rerun the CI?

@linbuxiao

chenrui333 commented 1 year ago

yeah, totally, rerun the CI just now.

linbuxiao commented 1 year ago

I notice that bilix info https://www.bilibili.com/video/av20203945/ succeed in some platform. I believe this error is related to the network since bilibili API is not always available in Github Action. Can you rerun the CI?

@linbuxiao

It seems that the retry failed, and I will try to replicate it in linux at a later date.

chenrui333 commented 1 year ago

thanks @linbuxiao!

chenrui333 commented 1 year ago

let me know if i need to help with anything

chenrui333 commented 1 year ago

This is running in the debug mode for the linux build

runner@fv-az593-769:/home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core$ bilix --debug info https://www.bilibili.com/video/av20203945/
DEBUG    Debug on, more information will be shown
DEBUG    CLI KEY METHOD and OPTIONS: {'method': 'info', 'keys': ('https://www.bilibili.com/video/av20203945/',), 'path': PosixPath('videos'), 'quality': 0, 'video_concurrency': 3, 'part_concurrency': 10, 'cookie': None, 'days': 7, 'num': 10,
         'order': 'pubdate', 'keyword': None, 'series': True, 'hierarchy': True, 'image': False, 'subtitle': False, 'dm': False, 'only_audio': False, 'p_range': None, 'codec': '', 'speed_limit': None, 'stream_retry': 5, 'browser': None,
         'time_range': None}
DEBUG    import cost 0.172222 s <module 'bilix.sites.bilibili'>
DEBUG    kwarg browser:None has been drop due to type hint missmatch
DEBUG    Assign to InformerBilibili

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Traceback (most recent call last) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ /home/linuxbrew/.linuxbrew/bin/bilix:8 in <module>                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   5 from bilix.cli.main import main                                                              โ”‚
โ”‚   6 if __name__ == '__main__':                                                                   โ”‚
โ”‚   7 โ”‚   sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])                         โ”‚
โ”‚ โฑ 8 โ”‚   sys.exit(main())                                                                         โ”‚
โ”‚   9                                                                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/click/core.p โ”‚
โ”‚ y:1157 in __call__                                                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1154 โ”‚                                                                                         โ”‚
โ”‚   1155 โ”‚   def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Any:                           โ”‚
โ”‚   1156 โ”‚   โ”‚   """Alias for :meth:`main`."""                                                     โ”‚
โ”‚ โฑ 1157 โ”‚   โ”‚   return self.main(*args, **kwargs)                                                 โ”‚
โ”‚   1158                                                                                           โ”‚
โ”‚   1159                                                                                           โ”‚
โ”‚   1160 class Command(BaseCommand):                                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/click/core.p โ”‚
โ”‚ y:1078 in main                                                                                   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1075 โ”‚   โ”‚   try:                                                                              โ”‚
โ”‚   1076 โ”‚   โ”‚   โ”‚   try:                                                                          โ”‚
โ”‚   1077 โ”‚   โ”‚   โ”‚   โ”‚   with self.make_context(prog_name, args, **extra) as ctx:                  โ”‚
โ”‚ โฑ 1078 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   rv = self.invoke(ctx)                                                 โ”‚
โ”‚   1079 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   if not standalone_mode:                                               โ”‚
โ”‚   1080 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   return rv                                                         โ”‚
โ”‚   1081 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   # it's not safe to `ctx.exit(rv)` here!                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/click/core.p โ”‚
โ”‚ y:1434 in invoke                                                                                 โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   1431 โ”‚   โ”‚   โ”‚   echo(style(message, fg="red"), err=True)                                      โ”‚
โ”‚   1432 โ”‚   โ”‚                                                                                     โ”‚
โ”‚   1433 โ”‚   โ”‚   if self.callback is not None:                                                     โ”‚
โ”‚ โฑ 1434 โ”‚   โ”‚   โ”‚   return ctx.invoke(self.callback, **ctx.params)                                โ”‚
โ”‚   1435 โ”‚                                                                                         โ”‚
โ”‚   1436 โ”‚   def shell_complete(self, ctx: Context, incomplete: str) -> t.List["CompletionItem"]:  โ”‚
โ”‚   1437 โ”‚   โ”‚   """Return a list of completions for the incomplete value. Looks                   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/click/core.p โ”‚
โ”‚ y:783 in invoke                                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    780 โ”‚   โ”‚                                                                                     โ”‚
โ”‚    781 โ”‚   โ”‚   with augment_usage_errors(__self):                                                โ”‚
โ”‚    782 โ”‚   โ”‚   โ”‚   with ctx:                                                                     โ”‚
โ”‚ โฑ  783 โ”‚   โ”‚   โ”‚   โ”‚   return __callback(*args, **kwargs)                                        โ”‚
โ”‚    784 โ”‚                                                                                         โ”‚
โ”‚    785 โ”‚   def forward(                                                                          โ”‚
โ”‚    786 โ”‚   โ”‚   __self, __cmd: "Command", *args: t.Any, **kwargs: t.Any  # noqa: B902             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/bilix/cli/ma โ”‚
โ”‚ in.py:374 in main                                                                                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   371 โ”‚   โ”‚   โ”‚   kwargs['path'].mkdir(parents=True)                                             โ”‚
โ”‚   372 โ”‚   โ”‚   โ”‚   logger.info(f'Directory {kwargs["path"]} not exists, auto created')            โ”‚
โ”‚   373 โ”‚   โ”‚   executor, cor = assign(kwargs)                                                     โ”‚
โ”‚ โฑ 374 โ”‚   โ”‚   loop.run_until_complete(cor)                                                       โ”‚
โ”‚   375 โ”‚   except HandleError as e:  # method no match                                            โ”‚
โ”‚   376 โ”‚   โ”‚   logger.error(e)                                                                    โ”‚
โ”‚   377 โ”‚   except KeyboardInterrupt:                                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/asyncio/base_events.py:653 in          โ”‚
โ”‚ run_until_complete                                                                               โ”‚
โ”‚                                                                                                  โ”‚
โ”‚    650 โ”‚   โ”‚   if not future.done():                                                             โ”‚
โ”‚    651 โ”‚   โ”‚   โ”‚   raise RuntimeError('Event loop stopped before Future completed.')             โ”‚
โ”‚    652 โ”‚   โ”‚                                                                                     โ”‚
โ”‚ โฑ  653 โ”‚   โ”‚   return future.result()                                                            โ”‚
โ”‚    654 โ”‚                                                                                         โ”‚
โ”‚    655 โ”‚   def stop(self):                                                                       โ”‚
โ”‚    656 โ”‚   โ”‚   """Stop running the event loop.                                                   โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/bilix/sites/ โ”‚
โ”‚ bilibili/informer.py:88 in temp                                                                  โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   85 โ”‚   โ”‚   โ”‚   โ”‚   for key in keys:                                                            โ”‚
โ”‚   86 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   if len(keys) > 1:                                                       โ”‚
โ”‚   87 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   logger.info(f"For {key}")                                           โ”‚
โ”‚ โฑ 88 โ”‚   โ”‚   โ”‚   โ”‚   โ”‚   await informer.info_key(key)                                            โ”‚
โ”‚   89 โ”‚   โ”‚   โ”‚                                                                                   โ”‚
โ”‚   90 โ”‚   โ”‚   โ”‚   return informer, temp()                                                         โ”‚
โ”‚   91                                                                                             โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/bilix/sites/ โ”‚
โ”‚ bilibili/informer.py:23 in info_key                                                              โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   20 โ”‚   โ”‚   return getattr(cls, func_name)                                                      โ”‚
โ”‚   21 โ”‚                                                                                           โ”‚
โ”‚   22 โ”‚   async def info_key(self, key):                                                          โ”‚
โ”‚ โฑ 23 โ”‚   โ”‚   await self.parse_url(key)(self, key)                                                โ”‚
โ”‚   24 โ”‚                                                                                           โ”‚
โ”‚   25 โ”‚   async def info_up(self, url: str):                                                      โ”‚
โ”‚   26 โ”‚   โ”‚   up_name, total_size, bvids = await api.get_up_info(self.client, url)                โ”‚
โ”‚                                                                                                  โ”‚
โ”‚ /home/linuxbrew/.linuxbrew/Cellar/bilix/0.18.4/libexec/lib/python3.11/site-packages/bilix/sites/ โ”‚
โ”‚ bilibili/informer.py:48 in info_video                                                            โ”‚
โ”‚                                                                                                  โ”‚
โ”‚   45 โ”‚   โ”‚   โ”‚   โ”‚   m.size = int(res.headers['Content-Range'].split('/')[-1])                   โ”‚
โ”‚   46 โ”‚   โ”‚                                                                                       โ”‚
โ”‚   47 โ”‚   โ”‚   dash = video_info.dash                                                              โ”‚
โ”‚ โฑ 48 โ”‚   โ”‚   cors = [ensure_size(m) for m in dash.videos] + [ensure_size(m) for m in dash.aud    โ”‚
โ”‚   49 โ”‚   โ”‚   await asyncio.gather(*cors)                                                         โ”‚
โ”‚   50 โ”‚   โ”‚                                                                                       โ”‚
โ”‚   51 โ”‚   โ”‚   tree = Tree(                                                                        โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
AttributeError: 'NoneType' object has no attribute 'videos'