Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.

jowsey/audius

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript API bindings for Audius.

Need help? Join the support server!: https://discord.gg/VBDhRc8/


npm npm

Basic Usage

const Audius = require('audius')
// The app name is requested by Audius. It is not required but strongly encouraged.
// The API is open and no key is required.
const audiusApp = new Audius("My Cool App v1.0.2")

// Searching for a user
audiusApp.searchUsers('Skrillex').then(users => {
  // Provided Skrillex was the first in the list, would print "Hey, Skrillex!"
  console.log("Hey,", users[0].name + "!" )
})

Methods

All methods return promises - if you have a modern editor with TS/JSdoc support, you shouldn't need these docs.
Name Description Parameters Returns
Audius#searchUsers(search: String) Find users by name. search: The search term to find users by. User[]
Audius#searchTracks(search: String) Find tracks by name. search: The search term to find tracks by. Track[]
Audius#searchPlaylists(search: String) Find playlists by name. search: The search term to find playlists by. Playlist[]
Audius#getTrack(id: String) Retrieve a track by ID. id: The unique ID of the track. Track
Audius#getUser(id: String) Retrieve a user by ID. id: The unique ID of the user. User
Audius#getPlaylist(id: String) Retrieve a playlist by ID. id: The unique ID of the playlist. Playlist
Audius#getTrendingTracks(time: String, genre: String) Get the top 100 trending tracks on Audius. time: The time range of which to get trending tracks. Either "week", "month" or "allTime". If blank, defaults to "week".
genre: The genre of which to get trending tracks for. If blank, defaults to any genre.
Track[]
Audius#getPlaylistTracks(id: String) Get the tracks of a playlist by ID. id: The unique ID of the playlist. Track[]
Audius#getUserTracks(id: String) Get the tracks uploaded by a user by ID. id: The unique ID of the user. Track[]
Audius#getUserFavourites(id: String) Get the favourites of a user by ID. id: The unique ID of the user. Favourite[]
Audius#streamTrack(id: String, download: Boolean) Stream the data of a track by ID. id: The unique ID of the track.
download: Whether to return once the entire file has been downloaded or return incomplete data that can be streamed.
Stream

Structures

Name Description Properties
User A user profile. albumCount: The number of albums this user has published.
bio: The bio of the user.
coverPhoto: A CoverPhoto containing three sizes of cover photo.
following: The number of accounts this user is following.
followers: The number of users that are following this account.
handle: The permanent name of the user.
id: The unique ID of the user.
verified: Whether the user is verified or not.
location: The location set on the user's profile.
name: The customisable name on the user's profile.
playlistCount: The number of playlists the user has published.
profilePicture: An Artwork containing three sizes of profile picture.
repostCount: The number of tracks the user has reposted.
trackCount: The number of original tracks the user has published.
Track A music track. artwork: An Artwork object containing links to three different sizes of artwork.
description: The track's description.
genre: The genre of the track.
id: The unique ID of the track.
mood: The mood of the track.
releaseDate: The release date of the track.
remixOf: The original track the track remixes, if any.
repostCount: The number of times the track has been reposted.
favouriteCount: The number of times the track has been favourited.
playCount: The number of times the track has been played.
tags: The track's tags that define its content.
title: The title of the track.
user: The user that uploaded the track.
duration: The length of the track in seconds.
downloadable: Whether or not the track is downloadable.
Playlist A playlist or album of multiple tracks. artwork: An Artwork object containing links to three different sizes of artwork.
description: The description of the playlist.
id: The unique ID of the playlist.
isAlbum: Whether the playlist is an album or not.
name: The name of the playlist.
repostCount: The number of times the playlist has been reposted.
favouriteCount: The number of times the playlist has been favourited.
totalPlayCount: The total number of track plays in the playlist.
user: The user that made the playlist.
Artwork A piece of artwork shown on a track, playlist or profile picture. small: The small 100x100 artwork.
medium: The medium 480x480 artwork.
large: The large 1000x1000 artwork.
CoverPhoto A cover photo on a user profile. small: The small 640x640 cover photo.
large: The large 2000x2000 cover photo.
Favourite A favourited item, such as a track. Does not contain the item itself, only the link between the user and the item. id: The unique ID of the favourite.
type: The type of Item this favourite is.
userID: The unique ID of the user that made this favourite.