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 TypeMethodDescriptionboolean
fetch()
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.int
hashCode()
boolean
Determines if the transcript was automatically generated by YouTube.boolean
Indicates 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
TranscriptContent
object. - 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
Transcript
representing 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:
String
API 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:
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
public boolean isTranslatable()Indicates whether the transcript can be translated.- Returns:
true
if the transcript is translatable;false
otherwise.
-
equals
-
hashCode
public int hashCode() -
toString
-