Skip to content

getURLType

LakhindarPal edited this page May 12, 2024 · 1 revision

Method: getURLType()

getURLType(url): string | null

Extracts the type of URL from a Tidal URL.

Parameters

  • url: string

The Tidal URL to extract the type from.

Returns

string | null

  • The type of URL extracted from the input URL, or null if the URL does not match the expected format.
  • The value will be TRACK,VIDEO,ALBUM,PLAYLIST,MIX,ARTIST or null

Usage

const { getURLType } = require("tidal-music-api");

// example url
const url = "https://tidal.com/browse/track/188267445";

const type = getURLType(url);

if (!type) console.log("Invalid URL");
else console.log(type);
Clone this wiki locally