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

运行报错,提示不存在data_size #381

Open
1552814024 opened this issue Jan 18, 2025 · 4 comments
Open

运行报错,提示不存在data_size #381

1552814024 opened this issue Jan 18, 2025 · 4 comments

Comments

@1552814024
Copy link

我用的的是v5.5代码版,不是封包exe版.。。。。
截图

Image

Traceback (most recent call last):
File "E:\douyinxiazai\code\main.py", line 19, in
run(main())
File "D:\Python\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "D:\Python\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "E:\douyinxiazai\code\main.py", line 10, in main
await downloader.run()
File "E:\douyinxiazai\code\src\application\TikTokDownloader.py", line 355, in run
await self.main_menu(safe_pop(self.run_command))
File "E:\douyinxiazai\code\src\application\TikTokDownloader.py", line 244, in main_menu
await self.compatible(mode)
File "E:\douyinxiazai\code\src\application\TikTokDownloader.py", line 324, in compatible
await self.__function_menu[n]1
File "E:\douyinxiazai\code\src\application\TikTokDownloader.py", line 251, in complete
await example.run(self.run_command)
File "E:\douyinxiazai\code\src\application\main_complete.py", line 1709, in run
await self.__function[n]1
File "E:\douyinxiazai\code\src\application\main_complete.py", line 232, in account_acquisition_interactive
await self.__secondary_menu(
File "E:\douyinxiazai\code\src\application\main_complete.py", line 260, in __secondary_menu
await function[n][1](*args, **kwargs, )
File "E:\douyinxiazai\code\src\application\main_complete.py", line 263, in account_detail_batch
await self.__account_detail_batch(
File "E:\douyinxiazai\code\src\application\main_complete.py", line 299, in __account_detail_batch
if not await self.deal_account_detail(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\douyinxiazai\code\src\application\main_complete.py", line 445, in deal_account_detail
return await self._batch_process_detail(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\douyinxiazai\code\src\application\main_complete.py", line 596, in batch_process_detail
data = await self.extractor.run(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\douyinxiazai\code\src\extract\extractor.py", line 161, in run
return await self.type[type
](data, recorder, tiktok, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\douyinxiazai\code\src\extract\extractor.py", line 187, in __batch
self.__platform_classify_detail(data, container, tiktok, )
File "E:\douyinxiazai\code\src\extract\extractor.py", line 816, in __platform_classify_detail
self.__extract_batch(
File "E:\douyinxiazai\code\src\extract\extractor.py", line 216, in __extract_batch
self.__extract_detail_info(container.cache, data)
File "E:\douyinxiazai\code\src\extract\extractor.py", line 308, in __extract_detail_info
self.__classifying_detail(item, data)
File "E:\douyinxiazai\code\src\extract\extractor.py", line 332, in __classifying_detail
self.__extract_video_info(item, data, _("视频"), )
File "E:\douyinxiazai\code\src\extract\extractor.py", line 436, in __extract_video_info
item["downloads"] = self.__extract_video_download(data, )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\douyinxiazai\code\src\extract\extractor.py", line 457, in __extract_video_download
i.play_addr.data_size,
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'types.SimpleNamespace' object has no attribute 'data_size'
(douyinvenv) E:\douyinxiazai\code>

Copy link

dosubot bot commented Jan 18, 2025

@1552814024 你好!我是Dosu,我是一个可以帮助你解决bug、回答问题,并成为贡献者的机器人。在等待人类维护者的过程中,我会尽力帮助你。

To resolve the AttributeError where 'types.SimpleNamespace' object has no attribute 'data_size' in the extractor.py file, you should modify the code to safely access the data_size attribute using the safe_extract method. This method provides a default value if the attribute is not present, preventing the error.

Here's how you can update the code in the __extract_video_download method:

bit_rate: list[tuple[int, int, int, int, int, list[str]]] = [(
    i.FPS,
    i.bit_rate,
    self.safe_extract(i.play_addr, "data_size", 0),  # Use safe_extract to avoid AttributeError
    i.play_addr.height,
    i.play_addr.width,
    i.play_addr.url_list,
) for i in bit_rate]

This change ensures that if data_size is not present in play_addr, a default value (e.g., 0) is used instead, thus preventing the AttributeError [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@JoeanAmier
Copy link
Owner

提供一下发生错误的作品链接。

@1552814024

This comment has been minimized.

@1552814024
Copy link
Author

提供一下发生错误的作品链接。

https://v.douyin.com/i8HrhL6p/

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

No branches or pull requests

2 participants