Package io.github.thoroldvix.api
Class Transcript
java.lang.Object
io.github.thoroldvix.api.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 TypeMethodDescriptionbooleanfetch()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.inthashCode()booleanDetermines if the transcript was automatically generated by YouTube.booleanIndicates whether the transcript can be translated.toString()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.
-
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.
-
getVideoId
Gets the video id of the transcript.- Returns:
- The video id as a
String.
-
getLanguage
Gets the language of the transcript.- Returns:
- The language as a
String.
-
getApiUrl
Returns API URL which needs to be called to fetch transcript content.- Returns:
StringAPI URL to fetch transcript content
-
getLanguageCode
Gets the language code of the transcript.- Returns:
- The language code as a
String.
-
isGenerated
public 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
public boolean isTranslatable()Indicates whether the transcript can be translated.- Returns:
trueif the transcript is translatable;falseotherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-