ytmusicapi.models package

Subpackages

Submodules

ytmusicapi.models.lyrics module

class ytmusicapi.models.lyrics.LyricLine(text: str, start_time: int, end_time: int, id: int) None

Bases: object

Represents a line of lyrics with timestamps (in milliseconds).

Parameters:
  • (str) (text) – The Songtext.

  • (int) (id) – Begin of the lyric in milliseconds.

  • (int) – End of the lyric in milliseconds.

  • (int) – A Metadata-Id that probably uniquely identifies each lyric line.

end_time: int
classmethod from_raw(raw_lyric: dict[str, Any]) ytmusicapi.models.lyrics.LyricLine

Converts lyrics in the format from the api to a more reasonable format

Parameters:

raw_lyric (dict[str, Any]) – The raw lyric-data returned by the mobile api.

Return LyricLine:

A LyricLine

Return type:

LyricLine

id: int
start_time: int
text: str
class ytmusicapi.models.lyrics.Lyrics

Bases: TypedDict

hasTimestamps: Literal[False]
lyrics: str
source: Optional[str]
class ytmusicapi.models.lyrics.TimedLyrics

Bases: TypedDict

hasTimestamps: Literal[True]
lyrics: list[LyricLine]
source: Optional[str]

Module contents

class ytmusicapi.models.LyricLine(text: str, start_time: int, end_time: int, id: int) None

Bases: object

Represents a line of lyrics with timestamps (in milliseconds).

Parameters:
  • (str) (text) – The Songtext.

  • (int) (id) – Begin of the lyric in milliseconds.

  • (int) – End of the lyric in milliseconds.

  • (int) – A Metadata-Id that probably uniquely identifies each lyric line.

end_time: int
classmethod from_raw(raw_lyric: dict[str, Any]) ytmusicapi.models.lyrics.LyricLine

Converts lyrics in the format from the api to a more reasonable format

Parameters:

raw_lyric (dict[str, Any]) – The raw lyric-data returned by the mobile api.

Return LyricLine:

A LyricLine

Return type:

LyricLine

id: int
start_time: int
text: str
class ytmusicapi.models.Lyrics

Bases: TypedDict

hasTimestamps: Literal[False]
lyrics: str
source: Optional[str]
class ytmusicapi.models.TimedLyrics

Bases: TypedDict

hasTimestamps: Literal[True]
lyrics: list[LyricLine]
source: Optional[str]