rany2/edge-tts

aiohttp.client_exceptions.WSServerHandshakeError: 403

Closed this issue · 2 comments

pyehon版本:3.12.3
最开始我使用的是edge-tts 6.1.12版本出现了这个错误,在使用pip install edge-tts==6.1.14更新到6.1.14版本后一切正常,edge-tts能正常运行,可是现在又出险了这个错误
/go # edge-tts --text "Hello world" --write-media "output.mp3" --voice "en-US-JennyNeural"
Traceback (most recent call last):
File "/opt/venv/bin/edge-tts", line 8, in
sys.exit(main())
^^^^^^
File "/opt/venv/lib/python3.12/site-packages/edge_tts/util.py", line 136, in main
asyncio.run(amain())
File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.12/site-packages/edge_tts/util.py", line 131, in amain
await _run_tts(args)
File "/opt/venv/lib/python3.12/site-packages/edge_tts/util.py", line 65, in _run_tts
async for chunk in tts.stream():
File "/opt/venv/lib/python3.12/site-packages/edge_tts/communicate.py", line 498, in stream
async for message in self.__stream():
File "/opt/venv/lib/python3.12/site-packages/edge_tts/communicate.py", line 365, in __stream
async with aiohttp.ClientSession(
File "/opt/venv/lib/python3.12/site-packages/aiohttp/client.py", line 1353, in aenter
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.12/site-packages/aiohttp/client.py", line 947, in _ws_connect
raise WSServerHandshakeError(
aiohttp.client_exceptions.WSServerHandshakeError: 403, message='Invalid response status', url='wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=6A5AA1D4EAFF4E9FB37E23D68491D6F4&ConnectionId=16984c1c7d53461b9a56b100672a6b1e'
我应该如何解决呢

Duplicate #286

很抱歉,由于没有看到#286 的issues