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

视频标题包含制表符\t时会报错 #122

Closed
journey-ad opened this issue Apr 19, 2023 · 2 comments · Fixed by #123
Closed

视频标题包含制表符\t时会报错 #122

journey-ad opened this issue Apr 19, 2023 · 2 comments · Fixed by #123
Labels
bug Something isn't working

Comments

@journey-ad
Copy link
Contributor

例如这条视频 https://www.bilibili.com/video/BV1zL4y1A7UE/

猜测包含其他特殊字符时也可能会有类似问题,本来想修完提pr的,但发现自己对py不太熟,就只提issue好了😂

报错日志

bilix v https://www.bilibili.com/video/BV1zL4y1A7UE/
WARNING  STREAM Unexpected Exception class:OSError [Errno 22] Invalid argument:
         'videos\\小品《我和爸爸换角色》郭冬临\t,金玉婷\t、小叮当-v.40520258104049'
WARNING  STREAM Unexpected Exception class:OSError [Errno 22] Invalid argument:
         'videos\\小品《我和爸爸换角色》郭冬临\t,金玉婷\t、小叮当-v.1620810020260124'
WARNING  STREAM Unexpected Exception class:OSError [Errno 22] Invalid argument:
         'videos\\小品《我和爸爸换角色》郭冬临\t,金玉婷\t、小叮当-v.3646822540520258'
Traceback (most recent call last):
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\Scripts\bilix.exe\__main__.py", line 7, in <module>
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\bilix\__main__.py", line 374, in main
    loop.run_until_complete(cor)
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\bilix\download\downloader_bilibili.py", line 405, in get_video
    path_lst, _ = await asyncio.gather(asyncio.gather(*media_cors), asyncio.gather(*add_cors))
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\bilix\download\base_downloader_part.py", line 180, in get_file
    file_list = await asyncio.gather(*cors)
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\bilix\download\base_downloader_part.py", line 202, in _get_file_part
    async with \
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\aiofiles\base.py", line 98, in __aenter__
    self._obj = await self._coro
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\site-packages\aiofiles\threadpool\__init__.py", line 97, in _open
    f = yield from loop.run_in_executor(executor, cb)
  File "C:\Users\jad\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
OSError: [Errno 22] Invalid argument: 'videos\\小品《我和爸爸换角色》郭冬临\t,金玉婷\t、小叮当-v.40520258104049'
@HFrost0
Copy link
Owner

HFrost0 commented Apr 19, 2023

bilix.utils:replace_illegal中负责这部分处理,win上\t属于非法的话加入一下就可以了。最近也比较忙,欢迎PR

@HFrost0 HFrost0 added the bug Something isn't working label Apr 20, 2023
@journey-ad
Copy link
Contributor Author

简单过滤掉\t可以解决这个问题,不过根本原因是传参时制表符\t或换行符\n等特殊字符里的反斜杠\没有转成字符串字面值\\
所以可能还是需要进一步优化,作者有空可以看看,我先按照过滤\t的方法提交pr了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants