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.boolean
Determines if the transcript was automatically generated by YouTube.boolean
Indicates 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
TranscriptContent
object. - 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:
String
API URL to fetch transcript content
-
isGenerated
boolean isGenerated()Determines if the transcript was automatically generated by YouTube.- Returns:
true
if the transcript was automatically generated;false
otherwise.
-
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:
true
if the transcript is translatable;false
otherwise.
-
translate
Translates the transcript into the specified language.- Parameters:
languageCode
- The language code to which the transcript should be translated.- Returns:
- A
Transcript
representing the translated transcript. - Throws:
TranscriptRetrievalException
- If the transcript cannot be translated.
-