Greasy Fork is available in English.
Pridajte tlačidlo prekladu do komentárov na YouTube && Live Chat Translation
< Spätná väzba na Tlačidlo prekladu komentárov na YouTube
Hello Linkwanggo
Can I ask you a few questions?
Did you use the API to translate the comments? If yes, how did you keep your API key secret from the public?
I'm new to JS and I want to create a script that uses the YouTube api to calculate playlist length, but I don't know how to keep the api key secret from the public.
Thanks.
This script uses the public API from Google. No token No secret key required.
https
://translate.goog
leapis.com/translate_a/single?client=gtx&sl=auto&tl=${localeLang}&dj=1&dt=t&dt=rm&q=${q}
tl
is the target language.sl
just set to auto.q
is the actual text you want to translate.fetch(`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${localeLang}&dj=1&dt=t&dt=rm&q=${q}`)
.then(res => {
return res.json()
})
.then(result => {
let resultText = result.sentences.map((function (s) {
return "trans" in s ? s.trans : "";
})).join("")
return resultText.split("\n");
}).then(result=>{ console.log(result) })
That's right. No token No secret key.
Hello Linkwanggo
Can I ask you a few questions?
Did you use the API to translate the comments? If yes, how did you keep your API key secret from the public?
I'm new to JS and I want to create a script that uses the YouTube api to calculate playlist length, but I don't know how to keep the api key secret from the public.
Thanks.