Use https for Google Translate URL (#35)

* Use https for Google Translate text-to-speech URL

* Update translate.ts
This commit is contained in:
Mohammed Anas
2021-08-28 17:08:34 +03:00
committed by GitHub
parent 47aa0c3b0e
commit 6f6ddfdda0

View File

@@ -66,7 +66,7 @@ export async function textToSpeechScrape(lang: string, text?: string) {
const slicedText = text.slice(0, text.length > 200 && lastSpace !== -1 ? lastSpace : 200);
const res = await fetch(
`http://translate.google.com/translate_tts?tl=${parsedLang}&q=${encodeURIComponent(slicedText)}&textlen=${slicedText.length}&client=tw-ob`,
`https://translate.google.com/translate_tts?tl=${parsedLang}&q=${encodeURIComponent(slicedText)}&textlen=${slicedText.length}&client=tw-ob`,
{
headers: {
"User-Agent": new UserAgent().toString()