This repository was archived by the owner on Sep 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 879
[Bug]: 跨日时抛出异常 BiliApiError: bad timestamp request #205
Copy link
Copy link
Open
Description
请确保您已阅读以上注意事项,并勾选下方的确认框。
- 我已经仔细阅读上述教程和 "提问前需知"
- 我已经在 Issue Tracker 中找过我要提出的问题,没有找到相同问题的ISSUE。
- 我已知晓并同意,此处仅用于汇报程序中存在的问题。若这个 Issue 是关于其他非程序本身问题,则我的 Issue 可能会被无条件自动关闭或/并锁定。
粉丝牌助手 版本
运行环境
Windows (64)
运行架构
None
部署方式
本地
粉丝牌数量
共148个,其中需要观看的有129个
日志记录(可选)
2024-11-28 00:00:02.932 | ERROR | __main__:main:109 - bad timestamp request,timestamp:1732723142,watchtime:60
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\fansMedalHelper\main.py", line 177, in <module>
loop.run_until_complete(main())
│ │ └ <function main at 0x0000023AF158F9C0>
│ └ <function BaseEventLoop.run_until_complete at 0x0000023AF1401760>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 674, in run_until_complete
self.run_forever()
│ └ <function ProactorEventLoop.run_forever at 0x0000023AF14ED620>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\windows_events.py", line 322, in run_forever
super().run_forever()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 641, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x0000023AF14034C0>
└ <ProactorEventLoop running=True closed=False debug=False>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 1986, in _run_once
handle._run()
│ └ <function Handle._run at 0x0000023AEFB69120>
└ <Handle Task.task_wakeup(<_GatheringFu...atchtime:60')>)>
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle Task.task_wakeup(<_GatheringFu...atchtime:60')>)>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle Task.task_wakeup(<_GatheringFu...atchtime:60')>)>
│ └ <member '_context' of 'Handle' objects>
└ <Handle Task.task_wakeup(<_GatheringFu...atchtime:60')>)>
> File "C:\Users\Administrator\Desktop\fansMedalHelper\main.py", line 107, in main
await asyncio.gather(*startTasks)
│ │ └ [<coroutine object BiliUser.start at 0x0000023AF26AAB60>]
│ └ <function gather at 0x0000023AF13EE0C0>
└ <module 'asyncio' from 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\asyncio\\__init__.py'>
File "C:\Users\Administrator\Desktop\fansMedalHelper\src\user.py", line 190, in start
File "C:\Users\Administrator\Desktop\fansMedalHelper\src\user.py", line 250, in watchinglive
if heartNum%5==0:
└ 22
File "C:\Users\Administrator\Desktop\fansMedalHelper\src\api.py", line 427, in heartbeat
),
File "C:\Users\Administrator\Desktop\fansMedalHelper\src\api.py", line 72, in wrapper
raise e
File "C:\Users\Administrator\Desktop\fansMedalHelper\src\api.py", line 61, in wrapper
result = await func(*args, **kwargs)
│ │ └ {'data': {'access_key': '*', 'actionKey': 'appkey', 'appkey': '4409e2ce8ffd12b8', 'area_id': '...
│ └ (<src.api.BiliApi object at 0x0000023AF26F0F80>, 'https://live-trace.bilibili.com/xlive/data-interface/v1/heartbeat/mobileHea...
└ <function BiliApi.__post at 0x0000023AF1ACB380>
File "C:\Users\Administrator\Desktop\fansMedalHelper\src\api.py", line 136, in __post
async with self.session.post(*args, **kwargs) as resp:
│ │ │ │ │ └ <ClientResponse(https://live-trace.bilibili.com/xlive/data-interface/v1/heartbeat/mobileHeartBeat) [200 OK]>
│ │ │ │ │ <CIMultiDictProx...
│ │ │ │ └ {'data': {'access_key': '*', 'actionKey': 'appkey', 'appkey': '4409e2ce8ffd12b8', 'area_id': '...
│ │ │ └ ('https://live-trace.bilibili.com/xlive/data-interface/v1/heartbeat/mobileHeartBeat',)
│ │ └ <function ClientSession.post at 0x0000023AF1AC8180>
│ └ <aiohttp.client.ClientSession object at 0x0000023AF149DCD0>
└ <src.api.BiliApi object at 0x0000023AF26F0F80>
File "C:\Users\Administrator\Desktop\fansMedalHelper\src\api.py", line 125, in __check_response
if resp["code"] != 0 or ("mode_info" in resp["data"] and resp["message"] != ""):
│ │ └ {'code': 1012003, 'message': 'bad timestamp request,timestamp:1732723142,watchtime:60', 'ttl': 1, 'data': None}
│ └ {'code': 1012003, 'message': 'bad timestamp request,timestamp:1732723142,watchtime:60', 'ttl': 1, 'data': None}
└ {'code': 1012003, 'message': 'bad timestamp request,timestamp:1732723142,watchtime:60', 'ttl': 1, 'data': None}
src.api.BiliApiError: bad timestamp request,timestamp:1732723142,watchtime:60补充说明(可选)
相关情况:
- 我使用的是我Fork的版本,主要调整了日志输出,且确认修改与问题原因无关
- 通过计划任务程序每日
00:05运行,计划配置见下方 - 未设置黑白名单,24小时不足以处理全部牌子
- 与Time.is比较,服务器时间无误差
您的系统时间准确无误!与 Time.is 的时间差是 +0.029 秒钟(±0.208 秒钟)。 - 问题稳定每天发生,仅发生于换日时,抛出异常后使程序结束,且会在推送中记为
任务执行失败 - 相关issues均以查看,未确认有效的解决方案
- 希望增加配置,在0点(或指定时间)结束任务并推送
计划任务程序配置:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2024-11-10T09:06:40.8407264</Date>
<Author>**********\Administrator</Author>
<URI>\fansMedalHelper</URI>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<StartBoundary>2024-11-10T00:05:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-3152784632-3446170954-2473191918-500</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>"C:\Users\Administrator\AppData\Local\Programs\Python\Python312\python.exe"</Command>
<Arguments>"C:\Users\Administrator\Desktop\fansMedalHelper\main.py"</Arguments>
</Exec>
</Actions>
</Task>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels