2024-07-23 11:06:41.239784
^CTraceback (most recent call last):
File "/home/work/admin/xiaohongshu/xhs_test.py", line 53, in <module>
note = xhs_client.get_note_by_id("659bd450000000001a000826")
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/site-packages/xhs/core.py", line 201, in get_note_by_id
res = self.post(uri, data)
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/site-packages/xhs/core.py", line 186, in post
self._pre_headers(uri, data, is_creator=is_creator)
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/site-packages/xhs/core.py", line 142, in _pre_headers
self.external_sign(
File "/home/work/admin/xiaohongshu/xhs_test.py", line 25, in sign
context_page.goto("https://www.xiaohongshu.com")
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 8851, in goto
self._sync(
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 113, in _sync
self._dispatcher_fiber.switch()
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/site-packages/playwright/sync_api/_context_manager.py", line 56, in greenlet_main
self._loop.run_until_complete(self._connection.run_as_sync())
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
self.run_forever()
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
self._run_once()
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/asyncio/base_events.py", line 1871, in _run_once
event_list = self._selector.select(timeout)
File "/home/work/.conda/envs/xiaohongshu/lib/python3.10/selectors.py", line 469, in select
fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
Future exception was never retrieved
future: <Future finished exception=TargetClosedError('Target page, context or browser has been closed')>
playwright._impl._errors.TargetClosedError: Target page, context or browser has been closed
如题,登陆并获取
cookie
(只填写了必要项:a1, webId, web_session)后运行basic_usage.py
,代码运行会一直卡在context_page = browser_context.new_page()
这一行单拎出来测试
playwright
好像也会遇到这个问题。报错信息(一直卡住之后,直接中断程序)如下:
请问有遇到类似问题的解决方法吗?