Skip to content

Commit

Permalink
docs: Update README to reflect package name change and usage examples
Browse files Browse the repository at this point in the history
  • Loading branch information
GFrancV committed Nov 7, 2024
1 parent 22ef8e3 commit 2b84b62
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Spotify Search is a package to search for Spotify tracks and playlists without t
Package install with with npm

```
npm install spotify-search
npm i spotify-search-wrapper
```

## Usage
Expand All @@ -36,61 +36,53 @@ npm install spotify-search
#### Searching track's

```js
const spotifySearch = require("spotify-search");

(async () => {
const tracks = await spotifySearch.searchTrack("Never Gonna Give You Up");
const spotifySearch = require("spotify-search-wrapper");

spotifySearch.searchTrack("Never Gonna Give You Up").then(tracks => {
console.log(tracks[0].id); // 4PTG3Z6ehGkBFwjybzWkR8
console.log(tracks[0].name); // Never Gonna Give You Up
console.log(tracks[0].href); // https://api.spotify.com/v1/tracks/4PTG3Z6ehGkBFwjybzWkR8
console.log(tracks[0].artists[0].name); // Rick Astley
})();
});
```

#### Searching playlist's

```js
const spotifySearch = require("spotify-search");

(async () => {
const playlists = await spotifySearch.searchPlaylist("Top 50 - Global");

spotifySearch.searchPlaylist("Top 50 - Global").then(playlists => {
console.log(playlists[0].id); // 37i9dQZEVXbMDoHDwVN2tF
console.log(playlists[0].name); // Top 50 - Global
console.log(playlists[0].href); // https://api.spotify.com/v1/playlists/37i9dQZEVXbMDoHDwVN2tF
console.log(playlists[0].owner.id); // spotify
})();
});
```

#### Get Track info

```js
const spotifySearch = require("spotify-search");

(async () => {
const track = await spotifySearch.getTrackInfoById("4PTG3Z6ehGkBFwjybzWkR8");

await spotifySearch.getTrackInfoById("4PTG3Z6ehGkBFwjybzWkR8").then(track => {
console.log(track.id); // 4PTG3Z6ehGkBFwjybzWkR8
console.log(track.name); // Never Gonna Give You Up
console.log(track.href); // https://api.spotify.com/v1/tracks/4PTG3Z6ehGkBFwjybzWkR8
console.log(track.artists[0].name); // Rick Astley
})();
});
```

#### Get Playlist info

```js
const spotifySearch = require("spotify-search");

(async () => {
const playlist = await spotifySearch.getPlaylist("37i9dQZEVXbMDoHDwVN2tF");

spotifySearch.getPlaylist("37i9dQZEVXbMDoHDwVN2tF").then(playlist => {
console.log(playlist.id); // 37i9dQZEVXbMDoHDwVN2tF
console.log(playlist.name); // Top 50 - Global
console.log(playlist.href); // https://api.spotify.com/v1/playlists/37i9dQZEVXbMDoHDwVN2tF
console.log(playlist.owner.id); // spotify
})();
});
```

### Tools
Expand Down

0 comments on commit 2b84b62

Please sign in to comment.