Class Client

Constructors

  • Creates a request client to api

    Example Usage;

    const client = new Client();

    client.findLyrics({ track_name: "The Chain", artist_name: "Fleetwood Mac" }).then(console.log);

    @notigorwastaken: I'm still working on it.

    Parameters

    • Optionaloptions: ClientOptions

      An optional object containing Client Options

    Returns Client

Methods

  • Finds lyrics for a given track using the API at https://lrclib.net/api/get.

    Example Usage:

    const lyrics = await findLyrics({ track_name: "The Chain", artist_name: "Fleetwood Mac" });
    

    Parameters

    • info: Query

      An object containing query parameters:

      • id: The unique identifier of the track (conditional).
      • track_name: The name of the track (conditional).
      • artist_name: The artist's name (conditional).
      • album_name: The album's name (optional).
      • duration: The song duration in milliseconds (optional).
    • Optionaloptions: RequestInit

    Returns Promise<FindLyricsResponse>

    A promise that resolves to a FindLyricsResponse object containing the track's lyrics.

    Will throw an error if the request fails or the track is not found.

  • Retrieves synchronized (timed) lyrics for a given track.

    Example Usage:

    const syncedLyrics = await getSynced({ track_name: "The Chain", artist_name: "Fleetwood Mac" });
    

    Parameters

    • info: Query

      An object containing query parameters:

      • id: The unique identifier of the track (conditional).
      • track_name: The name of the track (conditional).
      • artist_name: The artist's name (conditional).
      • album_name: The album's name (optional).
      • duration: The song duration in milliseconds (optional).

    Returns Promise<null | LyricLine[]>

    A promise that resolves to an array of LyricLine[] objects containing synchronized lyrics or null if no lyrics are found.

  • Retrieves unsynchronized (plain) lyrics for a given track.

    Example Usage:

    const unsyncedLyrics = await getUnsynced({ track_name: "The Chain", artist_name: "Fleetwood Mac" });
    

    Parameters

    • info: Query

      An object containing query parameters:

      • id: The unique identifier of the track (conditional).
      • track_name: The name of the track (conditional).
      • artist_name: The artist's name (conditional).
      • album_name: The album's name (optional).
      • duration: The song duration in milliseconds (optional).

    Returns Promise<null | LyricLine[]>

    A promise that resolves to an array of LyricLine[] objects containing unsynchronized lyrics or null if no lyrics are found.

  • Sends a request to the lyrics search API at https://lrclib.net/api/search.

    Example Usage:

    const search = await searchLyrics({ query: "The Chain" });
    

    Parameters

    • info: Search

      An object containing search parameters:

      • query: The search term (conditional | e.g., song title or lyrics fragment).
      • track_name: The name of the track (conditional).
      • artist_name: The artist's name (optional).
      • duration: The song duration in milliseconds (optional).
    • Optionaloptions: RequestInit

    Returns Promise<FindLyricsResponse[]>

    A promise that resolves to an array of FindLyricsResponse[].