ken107 / read-aloud

An awesome browser extension that reads aloud webpage content with one click
https://readaloud.app
MIT License
1.4k stars 237 forks source link

Add support for the Edge TTS voices #391

Open stemplock opened 7 months ago

stemplock commented 7 months ago

Add support for the tts service. https://github.com/rany2/edge-tts Please, if possible.

jkyndir commented 5 months ago

I had the exact same request. Microsoft Edge appears to have some amazing Voices

ken107 commented 5 months ago

I think this is probably possible

ken107 commented 3 months ago

It may or may not be possible, proof of concept needed.

The linked repo is a standalone Python program that calls Azure Speech Services and masquerades as the Speech component/extension in Microsoft Edge browser, by sending these headers when setting up the WebSocket connection:

{
  "Origin": "chrome-extension://jdiccldimpdaibmpdkjnbmckianbfold",
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.41"
}

I'm guessing Azure will reject the request if the headers aren't set correctly. But I'm not sure it's possible to set these headers in our Manifest V3 extension. Specifically:

  1. Does the declarativeNetRequest API allow modifying these two privileged headers (Origin and User-Agent), and
  2. Does the modification apply to the WebSocket setup requests
jkyndir commented 1 week ago

st if the headers aren't set correctly. But I'm not sure it's possible to set these headers in our Manifest V3 extension. Specifically:

Hi there, I found this chrome extension that managed to implement the Microsoft Edge TTS voices: MS Edge TTS (Text to Speech). But that extension is not able to directly read GooglePlayBooks.

Plz have a look, it seems it's possible to use Microsoft Edge voices in Chrome browsers.

ken107 commented 1 week ago

Okay, so looks like they don't validate those headers. So it will work. However, I'm hesitant to go ahead with this.

First, it'll be a bit of work. Second though, it will probably stop working frequently, as Bing implements countermeasures. https://github.com/rany2/edge-tts/issues/290. The above extension wasn't affected by this countermeasure though, so things are more complicated.

Once we add support for it, however, their server will be swamped, and they'll most likely have to increase security. It'll be a cat and mouse game. Unless, like IBM Watson, they reach out and request that we stop using their service.

We used to do the same to get free IBM Watson voices. But their team reached out, and we dropped support.