Package io.github.thoroldvix.api
Interface Transcript
public interface Transcript
Represents a single transcript for a YouTube video, including its metadata.
This interface provides methods to access the transcript content and to perform translations into different languages.
Individual transcripts can be obtained through the TranscriptList class.
-
Method Summary
Modifier and TypeMethodDescriptionfetch()Retrieves the content of the transcript.Returns API URL which needs to be called to fetch transcript content.Gets the language of the transcript.Gets the language code of the transcript.Lists all available translation languages for the transcript.Gets the video id of the transcript.booleanDetermines if the transcript was automatically generated by YouTube.booleanIndicates whether the transcript can be translated.Translates the transcript into the specified language.
-
Method Details
-
fetch
Retrieves the content of the transcript.- Returns:
- The content of the transcript as a
TranscriptContentobject. - Throws:
TranscriptRetrievalException- If the transcript content cannot be retrieved.
-
getVideoId
String getVideoId()Gets the video id of the transcript.- Returns:
- The video id as a
String.
-
getLanguage
String getLanguage()Gets the language of the transcript.- Returns:
- The language as a
String.
-
getLanguageCode
String getLanguageCode()Gets the language code of the transcript.- Returns:
- The language code as a
String.
-
getApiUrl
String getApiUrl()Returns API URL which needs to be called to fetch transcript content.- Returns:
StringAPI URL to fetch transcript content
-
isGenerated
boolean isGenerated()Determines if the transcript was automatically generated by YouTube.- Returns:
trueif the transcript was automatically generated;falseotherwise.
-
getTranslationLanguages
Lists all available translation languages for the transcript.- Returns:
- A set of language codes representing available translation languages.
-
isTranslatable
boolean isTranslatable()Indicates whether the transcript can be translated.- Returns:
trueif the transcript is translatable;falseotherwise.
-
translate
Translates the transcript into the specified language.- Parameters:
languageCode- The language code to which the transcript should be translated.- Returns:
- A
Transcriptrepresenting the translated transcript. - Throws:
TranscriptRetrievalException- If the transcript cannot be translated.
-