-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a78f24e
commit 2e62f81
Showing
44 changed files
with
6,160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
__tests__ | ||
coverage | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Tidal Music API | ||
|
||
## Introduction | ||
|
||
This npm package provides a simple wrapper for interacting with the Tidal API. It allows you to retrieve information about tracks, artists, albums, videos, playlists, and mixes based on their URLs. | ||
|
||
## Installation | ||
|
||
To install the package, run the following command: | ||
|
||
```bash | ||
npm install tidal-music-api | ||
``` | ||
|
||
## Usage | ||
|
||
### Getting Started | ||
|
||
First, import the `getInfo` function from the package: | ||
|
||
```javascript | ||
const { getInfo } = require("tidal-music-api"); | ||
``` | ||
|
||
### Retrieving Information | ||
|
||
You can use the `getInfo` function to retrieve information based on a Tidal URL: | ||
|
||
```javascript | ||
const url = "https://tidal.com/browse/track/12345678"; | ||
|
||
getInfo(url) | ||
.then((info) => { | ||
console.log(info); | ||
}) | ||
.catch((error) => { | ||
console.error("Error:", error.message); | ||
}); | ||
``` | ||
|
||
The `getInfo` function returns a Promise that resolves to the information based on the URL type (track, artist, album, video, playlist, or mix). | ||
|
||
### Supported URL Types | ||
|
||
- Track: `https://tidal.com/browse/track/<trackId>` | ||
- Artist: `https://tidal.com/browse/artist/<artistId>` | ||
- Album: `https://tidal.com/browse/album/<albumId>` | ||
- Video: `https://tidal.com/browse/video/<videoId>` | ||
- Playlist: `https://tidal.com/browse/playlist/<playlistId>` | ||
- Mix: `https://tidal.com/browse/mix/<mixId>` | ||
|
||
### Additional Usage | ||
|
||
#### Track | ||
|
||
You can also use the `getTrackId` and `getTrackInfo` functions to retrieve information about a specific track: | ||
|
||
```javascript | ||
const { getTrackId, getTrackInfo } = require("tidal-music-api"); | ||
|
||
const trackId = getTrackId(url); | ||
if (trackId) { | ||
getTrackInfo(trackId) | ||
.then((track) => { | ||
console.log(track); | ||
}) | ||
.catch((error) => { | ||
console.error("Error:", error.message); | ||
}); | ||
} | ||
``` | ||
|
||
#### Artist, Album, Video, Playlist, Mix | ||
|
||
Similarly, you can use the corresponding functions (`getArtistId`, `getArtistInfo`, `getAlbumId`, `getAlbumInfo`, `getVideoId`, `getVideoInfo`, `getPlaylistId`, `getPlaylistInfo`, `getMixId`, `getMixInfo`) for retrieving information about artists, albums, videos, playlists, and mixes. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request. | ||
|
||
## License | ||
|
||
This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
**tidal-music-api** • [**Docs**](globals.md) | ||
|
||
--- | ||
|
||
# Tidal API | ||
|
||
## Introduction | ||
|
||
This npm package provides a simple wrapper for interacting with the Tidal API. It allows you to retrieve information about tracks, artists, albums, videos, playlists, and mixes based on their URLs. | ||
|
||
## Installation | ||
|
||
To install the package, run the following command: | ||
|
||
```bash | ||
npm install tidal-music-api | ||
``` | ||
|
||
## Usage | ||
|
||
### Getting Started | ||
|
||
First, import the `getInfo` function from the package: | ||
|
||
```javascript | ||
const { getInfo } = require("tidal-music-api"); | ||
``` | ||
|
||
### Retrieving Information | ||
|
||
You can use the `getInfo` function to retrieve information based on a Tidal URL: | ||
|
||
```javascript | ||
const url = "https://tidal.com/browse/track/12345678"; | ||
|
||
getInfo(url) | ||
.then((info) => { | ||
console.log(info); | ||
}) | ||
.catch((error) => { | ||
console.error("Error:", error.message); | ||
}); | ||
``` | ||
|
||
The `getInfo` function returns a Promise that resolves to the information based on the URL type (track, artist, album, video, playlist, or mix). | ||
|
||
### Supported URL Types | ||
|
||
- Track: `https://tidal.com/browse/track/<trackId>` | ||
- Artist: `https://tidal.com/browse/artist/<artistId>` | ||
- Album: `https://tidal.com/browse/album/<albumId>` | ||
- Video: `https://tidal.com/browse/video/<videoId>` | ||
- Playlist: `https://tidal.com/browse/playlist/<playlistId>` | ||
- Mix: `https://tidal.com/browse/mix/<mixId>` | ||
|
||
### Additional Usage | ||
|
||
#### Track | ||
|
||
You can also use the `getTrackId` and `getTrackInfo` functions to retrieve information about a specific track: | ||
|
||
```javascript | ||
const { getTrackId, getTrackInfo } = require("tidal-music-api"); | ||
|
||
const trackId = getTrackId(url); | ||
if (trackId) { | ||
getTrackInfo(trackId) | ||
.then((track) => { | ||
console.log(track); | ||
}) | ||
.catch((error) => { | ||
console.error("Error:", error.message); | ||
}); | ||
} | ||
``` | ||
|
||
#### Artist, Album, Video, Playlist, Mix | ||
|
||
Similarly, you can use the corresponding functions (`getArtistId`, `getArtistInfo`, `getAlbumId`, `getAlbumInfo`, `getVideoId`, `getVideoInfo`, `getPlaylistId`, `getPlaylistInfo`, `getMixId`, `getMixInfo`) for retrieving information about artists, albums, videos, playlists, and mixes. | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request. | ||
|
||
## License | ||
|
||
This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[**tidal-music-api**](../README.md) • **Docs** | ||
|
||
--- | ||
|
||
[tidal-music-api](../globals.md) / extractURLType | ||
|
||
# Function: extractURLType() | ||
|
||
> **extractURLType**(`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. | ||
|
||
## Source | ||
|
||
index.ts:55 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[**tidal-music-api**](../README.md) • **Docs** | ||
|
||
--- | ||
|
||
[tidal-music-api](../globals.md) / getAlbumId | ||
|
||
# Function: getAlbumId() | ||
|
||
> **getAlbumId**(`url`): `number` | ||
Extracts the album ID from a given URL. | ||
|
||
## Parameters | ||
|
||
• **url**: `string` | ||
|
||
The URL from which to extract the album ID. | ||
|
||
## Returns | ||
|
||
`number` | ||
|
||
- The extracted album ID, or NaN if the URL does not match the expected format. | ||
|
||
## Source | ||
|
||
services/album.ts:60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[**tidal-music-api**](../README.md) • **Docs** | ||
|
||
--- | ||
|
||
[tidal-music-api](../globals.md) / getAlbumInfo | ||
|
||
# Function: getAlbumInfo() | ||
|
||
> **getAlbumInfo**(`albumId`, `countryCode`?): `Promise`\<`Album`\> | ||
Retrieves album information from the Tidal API based on the provided album ID and country code. | ||
|
||
## Parameters | ||
|
||
• **albumId**: `number` | ||
|
||
The ID of the album. | ||
|
||
• **countryCode?**: `string`= `"US"` | ||
|
||
The country code to use for retrieving the album information. Defaults to "US". | ||
|
||
## Returns | ||
|
||
`Promise`\<`Album`\> | ||
|
||
A promise that resolves to an Album object containing the album information. | ||
|
||
## Source | ||
|
||
services/album.ts:11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[**tidal-music-api**](../README.md) • **Docs** | ||
|
||
--- | ||
|
||
[tidal-music-api](../globals.md) / getArtistId | ||
|
||
# Function: getArtistId() | ||
|
||
> **getArtistId**(`url`): `number` | ||
Extracts the artist ID from a Tidal URL. | ||
|
||
## Parameters | ||
|
||
• **url**: `string` | ||
|
||
The Tidal URL from which to extract the artist ID. | ||
|
||
## Returns | ||
|
||
`number` | ||
|
||
The extracted artist ID, or NaN if the URL does not match the expected format. | ||
|
||
## Source | ||
|
||
services/artist.ts:115 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[**tidal-music-api**](../README.md) • **Docs** | ||
|
||
--- | ||
|
||
[tidal-music-api](../globals.md) / getArtistInfo | ||
|
||
# Function: getArtistInfo() | ||
|
||
> **getArtistInfo**(`artistId`, `countryCode`?): `Promise`\<`Artist`\> | ||
Retrieves the information of an artist from the Tidal API based on the provided artist ID and country code. | ||
|
||
## Parameters | ||
|
||
• **artistId**: `number` | ||
|
||
The ID of the artist. | ||
|
||
• **countryCode?**: `string`= `"US"` | ||
|
||
The country code to use for retrieving the artist information. Defaults to "US". | ||
|
||
## Returns | ||
|
||
`Promise`\<`Artist`\> | ||
|
||
A promise that resolves to an Artist object containing the artist information. | ||
|
||
## Source | ||
|
||
services/artist.ts:11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[**tidal-music-api**](../README.md) • **Docs** | ||
|
||
--- | ||
|
||
[tidal-music-api](../globals.md) / getInfo | ||
|
||
# Function: getInfo() | ||
|
||
> **getInfo**(`url`): `Promise`\<`Track` \| `Artist` \| `Album` \| `Video` \| `Playlist` \| `Mix`\> | ||
Retrieves information based on the type of URL provided. | ||
|
||
## Parameters | ||
|
||
• **url**: `string` | ||
|
||
The URL to extract information from. | ||
|
||
## Returns | ||
|
||
`Promise`\<`Track` \| `Artist` \| `Album` \| `Video` \| `Playlist` \| `Mix`\> | ||
|
||
A promise that resolves to the information based on the URL type. | ||
|
||
## Source | ||
|
||
index.ts:19 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[**tidal-music-api**](../README.md) • **Docs** | ||
|
||
--- | ||
|
||
[tidal-music-api](../globals.md) / getMixId | ||
|
||
# Function: getMixId() | ||
|
||
> **getMixId**(`url`): `string` | ||
Extracts the mix ID from a given URL. | ||
|
||
## Parameters | ||
|
||
• **url**: `string` | ||
|
||
The URL from which to extract the mix ID. | ||
|
||
## Returns | ||
|
||
`string` | ||
|
||
- The extracted mix ID, or empty string if the URL does not match the expected format. | ||
|
||
## Source | ||
|
||
services/mix.ts:58 |
Oops, something went wrong.