
:max_bytes(150000):strip_icc()/YouTubeAutoCCExample2-d21c37526d7a4fb6950ea25c98581a10.jpg)

Is there any way my goal can be achieved in java (for offline solutions) or javascript (for online solutions)?ĭefaultId = 'fJ9rUzIMcZQ', /* Queen – Bohemian Rhapsody */ I've also tried an ugly solution with parsing YouTube Player IFrame (there is a div inside it with current subtitles' line), but it doesn't work because of origin mismatch security issues. I haven't found YouTube Player Api methods for captions, also I've tried to get YouTube captions as TextTrack with videojs player in the way it could be done for usual videos, but the following doesn't work: Ĭonsole.log('Tracks: ' + this.textTracks().length) //zero here :(Ĭonsole.log('Ready State', aTextTrack.readyState()) Initially I've tried to do it offline via YouTube API, but as it seems YouTube forbids to fetch subtitles of videos you are not the owner. How can programmatically get subtitles of a playing YouTube video?
