YouTube live streaming captions - more than one language - youtube-api

I'm currently live streaming a tv channel (beta phase yet) using YouTube.
How do I add captions in more than 1 language for a live stream (with POST caption URL)?
Even using just one language captions, how can I change the language? (The only option to the user - on web or app - is "EN" even if the caption is in other language)
When using POST approach do send captions on live streams how/where to set/define duration of each subtitle?
Please don't refer this url link. I know it already.

AFAIK you can do only one language, if any at all. I have tried using the POST method YouTube describes on the page you link to - without success. Only get
Result 299: "Error donwloading [...] Can't parse HTTP POST body."
Tried searching all kinds of support forums, but it seems no one has any advice and YouTube never replies to questions related to live caption. Including here...

According to the docs on contentDetails.closedCaptionsType, you can embed captions in your video stream using the option closedCaptionsEmbedded and provide EIA-608 and/or CEA-708 formatted captions in your video from your encoder.
Sending multiple caption tracks muxed with your video with different languages specified by the "Language" tag on the caption stream should allow the user to switch between different captions in the web player.

Related

For YouTube video, how to automatically display interactive transcript?

YouTube supports interactive-transcripts, using both machine-generated and user-uploaded transcripts. This is very useful for hearings, lectures, speeches, and educational videos where a visitor might want to read along or jump around. For example in this video:
https://www.youtube.com/watch?v=IY3U2GXhz44
The visitor can click on "...More" and then "Transcript" to view the interactive-transcript.
How does a video owner make that hidden feature automatically open for visitors? I cannot find any documented method for doing that through the API for either embed or linked videos. Is there an undocumented method in the API, or a URL parameter like "&action-panel-transcript=true" that works the way I'd expect it to?
As for url parameter, you can try adding &cc_load_policy=1 behind the rel=0 if it's an embedded video or &yt:cc=on at the end of the url if it's a link to the video.
Source: https://www.makeuseof.com/tag/force-subtitles-embedded-youtube-video/

Localization in PlaylistItems YouTube API

I have an application that uses the YouTube API to display a list of playlists and videos from a particular YouTube Channel. The application supports multiple languages so I also used the localizations feature YouTube API offers and it works great with v3/videos and v3/playlists using the hl param, but the only problem I faced was with v3/playlistItems as it doesn't have support for localizations.
Please help me in adding localizations using v3/playlistItems so that all videos under a particular playlist displays localized title and description.
An ugly work around is to send two requests. First fetch the video-ids by using v3/playlistItems, then use v3/videos with the video-ids separated by comma, to get the translation with the available hl param.
There is currently no indicated way of doing this from the PlaylistItems docs. Try filing for a feature request here.

Is it possible to search YouTube subtitles?

Suppose I want to find list of videos which have the phrase "French presidential election" in its subtitle.
Can I do this using YouTube API?
It will be perfect if it can even search within both human-generated and auto-generated subtitles. But it will be good enough if it can search either of the two types of subtitles.
You may refer with this documentation. You can use Captions: list which returns a list of caption tracks that are associated with a specified video.
Note that the API response does not contain the actual captions and that the captions.download method provides the ability to retrieve a caption track.
You need to provide the videoId parameter that specifies the YouTube video ID of the video for which the API should return caption tracks.
Here's a related thread: How to add Subtitles to Youtube video using Youtube API?
If you want to just search the subtitles from a particular video that is open on youtube.com you can view all the subtitles by selecting 'Open Transcript' from the ... button which is displayed below the main video window and to the right of the title (to the right of SAVE) - then you can just search them using the browser's page search functionality (i.e. Mac: ⌘+F, Win: Ctrl+F)

Closed Captions in YouTube as JSON

Is there a way to get closed captions in a youtube clip as json ? I read passing "alt=json" should work, but it doesn't seem to. Any idea ? Also does the CC also work when it is done via translation ? For example
curl "http://www.youtube.com/api/timedtext?v=V6Tsrg_EQMw&lang=en" doesn't return anything (though the clip does have CC)
There currently is no supported API for retrieving closed caption tracks for arbitrary videos. (You might be able to reverse-engineer some methods of getting that data, but it's not supported and I can't encourage doing that.)
The officially supported methods for working with captions are for v2 of the YouTube Data API and are documented at https://developers.google.com/youtube/2.0/developers_guide_protocol_captions
Only an authenticated request as the owner of a given video will expose the list of caption tracks and allow you to download them in .srt or .sub format (not JSON).
I would expect that at some point there will be methods for interacting with captions in v3 of the API, but unfortunately I don't have any specific information to share about when that might happen.
Use youtube-dl to download the captions (as either srt, ass, vtt, or lrc).
Use TranscribeFiles' Online Captions & Subtitles Converter to convert to any of 11 different json schemas.

Youtube Search Results as Playlist, Need Advise

Hi guys, this is my first time to post on this awesome community so
please bear with me.
I am working with a Wordpress Plugin that can display a Youtube Search Results into Video Playlist.
My settings are:
Keywords
Author
Content- channel/keyword
My first Approach was this:
with this api as reference,
search for the keyword > display the relevant results according to the author as playlist
*I'm in doubt if I this is possible, coding 30%
*I'm not sure where could I use my settings for Content
but then when my coding is in progress I recently bumped an article that says Youtube Search is differrent on Searching a Youtube Playlist
Now I can't continue my coding because I'm not sure If I'm doing it
right. Can you give me some advise with this situation or show me some
similar project/examples?
You don't have to write any YouTube Data API code for this; it's a built-in feature of the YouTube Player.
This blog post has an example of loading a list player that takes its content from the recent uploads of a channel. You can do something similar by setting listType=search&list=SEARCH_TERM, where SEARCH_TERM is whatever string you want to search for (be sure to URL escape it). You can read more in the documentation.

Resources