Created
December 2, 2017 16:26
-
-
Save 1c7/49b642bd92d821b3783f7458ea1cfd5b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function get_auto_subtitle_xml_url(){ | |
| var raw_string = ytplayer.config.args.player_response; | |
| var json = JSON.parse(raw_string); | |
| var captionTracks = json.captions.playerCaptionsTracklistRenderer.captionTracks; | |
| for (var index in captionTracks){ | |
| var caption = captionTracks[index]; | |
| if(typeof caption.kind === 'string' && caption.kind == 'asr'){ | |
| return captionTracks[index].baseUrl + "&fmt=3"; | |
| } | |
| // ASR – A caption track generated using automatic speech recognition. | |
| // https://developers.google.com/youtube/v3/docs/captions | |
| } | |
| return null; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment