Search for content on YouTube Music including songs, albums, artists, playlists, and more.

search(
$query,
$filter = null,
$scope = null,
$limit = 20,
$ignore_spelling = false
)

Search YouTube Music and return results within the provided category.

Parameters

$query string

Query string, e.g., 'Oasis Wonderwall'

$filter string|null

Filter for item types. Allowed values: songs, videos, albums, artists, playlists, community_playlists, featured_playlists, uploads

$scope string|null

Search scope. Allowed values: library, uploads

$limit int

Number of search results to return (default: 20). The number of results may differ based on what YouTube Music returns.

$ignore_spelling bool

Whether to ignore YouTube Music spelling suggestions (default: false)

Returns

SearchResult[] - List of search results

// Basic search
$results = $yt->search("Oasis Wonderwall");

// Search for specific content type
$albums = $yt->search("Oasis", filter: "albums");

// Search in library
$library_songs = $yt->search("Wonderwall", scope: "library");

get_search_suggestions($query, $detailed_runs = false)

Get search suggestions for a query.

Parameters

$query string

Query string, e.g., 'faded'

$detailed_runs bool

Whether to return detailed runs of each suggestion (default: false)

$suggestions = $yt->get_search_suggestions("faded");
$detailed = $yt->get_search_suggestions("faded", detailed_runs: true);

Browse

Browse and retrieve detailed information about artists, albums, songs, and users.

get_home()

Get the home page with music suggestions and recommendations.

Returns

array - Home page content with titled rows of music suggestions

$home = $yt->get_home();

get_artist($channelId)

Get information about an artist including albums, songs, and related content.

Parameters

$channelId string

Artist's channel ID

$artist = $yt->get_artist("UCR28YDxjDE3ogQROaNdnRbQ");

get_album($browseId)

Get information about an album including tracks and metadata.

Parameters

$browseId string

Album's browse ID

$album = $yt->get_album("MPREb_BQZvl0P6ern");

get_song($videoId, $signatureTimestamp = null)

Returns metadata and streaming information about a song or video.

Parameters

$videoId string

Video ID of the song

$signatureTimestamp int|null

YouTube signature timestamp (optional)

$song = $yt->get_song("kJQP7kiw5Fk");

get_song_info($videoId)

Get basic information about a track, including whether it's a music video or not. (PHP-specific method)

Parameters

$videoId string|Song

Video ID or Song object

Returns

SongInfo - Basic song information with music flag

$info = $yt->get_song_info("kJQP7kiw5Fk");
if ($info->music) {
    echo "This is a music track";
}

get_lyrics($browseId)

Get lyrics for a song.

Parameters

$browseId string

Lyrics browse ID (from song or track object)

$lyrics = $yt->get_lyrics($track->lyrics);

get_user($channelId)

Get information about a user and their public content.

Parameters

$channelId string

User's channel ID

$user = $yt->get_user("UC123456789");

Library

Access and manage your personal YouTube Music library. Requires authentication.

get_library_playlists($limit = 25)

Retrieve playlists from your library.

Parameters

$limit int

Number of playlists to retrieve (default: 25). The number of playlists may differ based on what YouTube Music returns.

Returns

PlaylistInfo[] - List of owned playlists

$playlists = $yt->get_library_playlists();

get_library_songs($limit = 25, $validate_responses = false, $order = null)

Get songs from your library (liked videos are not included).

Parameters

$limit int

Number of songs to retrieve (default: 25). The number of songs may differ based on what YouTube Music returns.

$validate_responses bool

Whether to validate and retry responses (default: false)

$order string|null

Order of songs. Values: 'a_to_z', 'z_to_a', 'recently_added'

Returns

Track[] - List of songs in library

$songs = $yt->get_library_songs(limit: 50, order: "recently_added");

get_library_albums($limit = 25, $order = null)

Get albums from your library.

Parameters

$limit int

Number of albums to return (default: 25). The number of albums may differ based on what YouTube Music returns.

$order string|null

Order of albums. Values: 'a_to_z', 'z_to_a', 'recently_added'

Returns

AlbumInfo[] - List of albums

get_library_artists($limit = 25, $order = null)

Get artists from your library.

get_history()

Get your music history.

Returns

Track[] - List of recently played tracks

rate_song($videoId, $rating = "INDIFFERENT")

Rate a song (like, dislike, or indifferent).

Parameters

$videoId string

Video ID of the song

$rating string

Rating: "LIKE", "DISLIKE", or "INDIFFERENT"

$yt->rate_song("kJQP7kiw5Fk", "LIKE");

Playlists

Create, manage, and interact with playlists. Most operations require authentication.

get_playlist(
$playlistId,
$limit = 100,
$related = false,
$suggestions_limit = 0,
$get_continuations = true
)

Returns information and tracks of a playlist.

Parameters

$playlistId string

Playlist ID

$limit int

Maximum number of tracks to return (default: 100)

$related bool

Whether to return related playlists (default: false)

$suggestions_limit int

Maximum number of suggestions to return (default: 0)

$get_continuations bool

Whether to get all tracks or return continuation token (default: true) (PHP-specific)

Returns

Playlist - Playlist object with tracks and metadata

$playlist = $yt->get_playlist("PLfY7JYgRs-QJZP7zqsKPFMqKJ5qghLqm_");

get_playlist_continuation($playlistId, $token)

Get continuation of playlist tracks for pagination. (PHP-specific method)

Parameters

$playlistId string

Playlist ID

$token string

Continuation token from previous playlist request

// Get first batch
$playlist = $yt->get_playlist("LM", get_continuations: false);

// Get next batch
while ($playlist->continuation) {
    $next = $yt->get_playlist_continuation("LM", $playlist->continuation);
    $playlist->tracks = array_merge($playlist->tracks, $next->tracks);
    $playlist->continuation = $next->continuation;
}

get_liked_songs($limit = 100)

Get your liked songs playlist.

$liked = $yt->get_liked_songs();

create_playlist(
$title,
$description,
$privacy_status = "PRIVATE",
$video_ids = null,
$source_playlist = null
)

Create a new playlist.

Parameters

$title string

Playlist title

$description string

Playlist description

$privacy_status string

Privacy: "PUBLIC", "PRIVATE", or "UNLISTED" (default: "PRIVATE")

$video_ids array|null

Video IDs to add to the playlist

$source_playlist string|null

Source playlist to copy songs from

$playlist_id = $yt->create_playlist(
    "My Favorite Songs", 
    "Collection of my favorite tracks",
    "PRIVATE",
    ["kJQP7kiw5Fk", "dQw4w9WgXcQ"]
);

edit_playlist(
$playlistId,
$title = null,
$description = null,
$privacyStatus = null,
$moveItem = null,
$addPlaylistId = null,
$addToTop = null
)

Edit playlist properties or add content from another playlist.

delete_playlist($playlistId)

Delete a playlist.

$yt->delete_playlist("PLfY7JYgRs-QJZP7zqsKPFMqKJ5qghLqm_");

add_playlist_items(
$playlistId,
$videoIds = null,
$source_playlist = null,
$duplicates = false
)

Add songs to an existing playlist.

Parameters

$playlistId string

Playlist ID

$videoIds array|null

Video IDs to add

$source_playlist string|null

Source playlist to copy from

$duplicates bool

Allow duplicate songs (default: false)

$yt->add_playlist_items(
    "PLfY7JYgRs-QJZP7zqsKPFMqKJ5qghLqm_",
    ["kJQP7kiw5Fk", "dQw4w9WgXcQ"]
);

remove_playlist_items($playlistId, $videos)

Remove songs from a playlist.

Parameters

$playlistId string

Playlist ID

$videos array

List of playlist items with setVideoId to remove

Watch

Get watch playlists and track information for continuous playback.

get_watch_playlist(
$videoId = null,
$playlistId = null,
$limit = 25,
$radio = false,
$shuffle = false
)

Get a watch list of tracks for continuous playback.

Parameters

$videoId string|null

Video ID of the played video

$playlistId string|null

Playlist ID of the played playlist or album

$limit int

Minimum number of watch playlist items to return (default: 25). Number of items may differ based on what YouTube Music returns.

$radio bool

Get a radio playlist that changes each time (default: false)

$shuffle bool

Shuffle the input playlist (default: false)

Returns

WatchList - Watch playlist with tracks and related information

// Get watch playlist for a song
$watch = $yt->get_watch_playlist(videoId: "kJQP7kiw5Fk");

// Get radio playlist
$radio = $yt->get_watch_playlist(videoId: "kJQP7kiw5Fk", radio: true);

get_track($videoId)

Get track information including IDs to retrieve lyrics and related tracks. (PHP-specific method)

Parameters

$videoId string

Video ID

Returns

WatchTrack - Track object with additional IDs for lyrics and related content

$track = $yt->get_track("kJQP7kiw5Fk");
$lyrics = $yt->get_lyrics($track->lyrics);
$related = $yt->get_song_related($track->related);

Charts

Access music charts and trending content from around the world.

get_charts($country = "ZZ")

Get latest charts data from YouTube Music including top videos, artists, and genres.

Parameters

$country string

ISO 3166-1 Alpha-2 country code (default: "ZZ" = Global)

Returns

array - Charts data with videos, artists, and genres (US-only)

// Get global charts
$global_charts = $yt->get_charts();

// Get US charts (includes genres)
$us_charts = $yt->get_charts("US");

Explore

Discover new music through mood categories and curated playlists.

get_mood_categories()

Get available mood categories for music discovery.

$moods = $yt->get_mood_categories();

get_mood_playlists($params)

Get playlists for a specific mood category.

Parameters

$params string

Parameters from mood category

Uploads

Manage your uploaded music content. Requires authentication.

get_library_upload_songs($limit = 25, $order = null)

Get list of uploaded songs from your library.

Returns

UploadTrack[] - List of uploaded songs

$uploads = $yt->get_library_upload_songs();

get_library_upload_albums($limit = 25, $order = null)

Get albums of uploaded songs from your library.

upload_song($filepath)

Upload a song to YouTube Music.

Parameters

$filepath string

Path to music file (mp3, m4a, wma, flac, or ogg)

Requirements: Requires browser authentication and files must be under 300MB.
$result = $yt->upload_song("/path/to/song.mp3");

delete_upload_entity($entityId)

Delete a previously uploaded song or album.

Parameters

$entityId string

Entity ID from uploaded content

Podcasts

Browse and manage podcast content on YouTube Music.

get_podcast($playlistId, $limit = 100)

Get information about a podcast and its episodes.

Parameters

$playlistId string

Podcast playlist ID

$limit int

Number of episodes to return (default: 100)

$podcast = $yt->get_podcast("PLgH1bHkDmEYz1234567890");

get_episode($videoId)

Get information about a podcast episode.

Parameters

$videoId string

Episode video ID

Returns

Episode - Episode information including title, description, and metadata

$episode = $yt->get_episode("nDnLSYCOg7E");

get_channel($channelId)

Get information about a podcast channel.

Authentication Required: Methods marked with 🔒 require authentication. See the Authentication Guide for setup instructions.
PHP-Specific Methods: Some methods marked with (PHP-specific) are enhancements not available in the original Python version.