dual-captions
dual-captions copied to clipboard
Download machine translation subtitle when there is not subtitle on youtube.
Recently i did clone, So when there is no translated caption for the video, It is possible to fetch machine translated caption from this url:
https://www.youtube.com/api/timedtext?v=LNl2bLJilt0&lang=en-GB&fmt=json3&tlang=fa
e.g. Translate from en-GB to Persian (fa).
Also I was not figured out how i can contribute in this awesome project, It seems there's no WebPack configuration to auto generate builds to develop easy, or I didn't figured out.
Hi!
It is possible to fetch machine translated caption from this url
Interesting, what is the schema of the request body? I wonder if it is restricted to certain videos / text or if you could pass any text.
I made a proof-of-concept for using an external API for translations here: https://github.com/mikesteele/dual-captions/commit/d578258c825d003dd3f8c5731e6f5772b4c56f47
Replace
window.setTimeout(() => {
_set(this.translations, [secondSubtitleLanguage, captionText], `${captionText} :-)`);
}, 300);
With something like this:
fetch('https://www.youtube.com/api/timedtext?v=LNl2bLJilt0&lang=en-GB&fmt=json3&tlang=fa')
.then(resp => resp.json())
.then(json => {
const translation = json.translation;
_set(this.translations, [secondSubtitleLanguage, captionText], translation);
});
It seems there's no WebPack configuration to auto generate builds to develop easy, or I didn't figured out.
After you build the extension for the first time (./build-extension.sh
) you can run yarn start
in individual packages to develop them with hot reloading.
[quote]
what is the schema of the request body?
[/quote]
I don't know that. Just select auto translate on youtube website and shown the request at network tab inside inspector with a bunch of other params too.
I saw you wrote your xml convertor something like that, also it is possible to pass srv3
as fmt
query parameter to achieve xml
or pass noting as format fmt
to achieve transcript xml without body tag or sth else.
Thanks for your descriptions about WebPack
.