recommend_from_song
Find new songs similar to a seed song by title, artist, or video ID, ranked by matching signals. Filters by language and tempo, and excludes songs already liked or in playlists.
Instructions
Recommend new songs similar to a seed song.
Seed the search either with a known video_id, or with song (a free-text
title, optionally narrowed with artist) to have the seed resolved via
search internally -- e.g. "10 songs that relate to Kryptonite by 3 Doors
Down" needs no separate lookup first. Exactly one of video_id or song
must be given.
Combines YouTube Music's radio, its separate "related" signal, and the seed artist's own catalog plus related artists' catalogs, then ranks by how many independent signals agreed on each candidate. Never returns the seed song itself, and never returns a song already in Liked Music or in ANY of the user's playlists.
By default candidates can come from OTHER artists too (radio/related
signals surface stylistically similar tracks, not just the seed artist's
own catalog) -- pass same_artist_only=True to keep only songs credited
to the seed's own artist(s), e.g. for "recommend songs BY artist X similar
to song Y" requests.
language / exclude_languages filter the RESULTS independently of the
seed, which is the point: seeding from a Punjabi song with
language=["english"] returns English songs similar to it. Strict by
default -- candidates with no language label are dropped, since a
Punjabi-seeded pool is mostly Punjabi and keeping unlabelled ones would
hand back exactly what was excluded. Pass allow_unlabelled_language=True
to relax that; the response always reports what was dropped.
When a language filter leaves too few results -- seeding from a Punjabi song and asking for English usually does -- the surviving songs are used as fresh seeds to reach more of that language in the same neighbourhood, since filtering alone can only return what happened to be in the seed's own pool. Set expand_across_language=False to skip that and get the short list.
match_seed_tempo=True biases results toward the seed's own BPM (half-
and double-time count as close). bpm sets a tempo target directly, and
bpm_min/bpm_max bound it. Songs with no known BPM are kept and simply
not scored on tempo.
Returns {"songs": [...], "notes": [...], "filters": {...}} -- notes carry anything the user should hear about, such as results dropped for having no language label.
The library exclusion set is cached for speed; newly liked songs are always honoured, but call refresh_library() after adding songs to a playlist by other means.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bpm | No | ||
| song | No | ||
| limit | No | ||
| artist | No | ||
| bpm_max | No | ||
| bpm_min | No | ||
| language | No | ||
| video_id | No | ||
| max_per_artist | No | ||
| match_seed_tempo | No | ||
| same_artist_only | No | ||
| exclude_languages | No | ||
| expand_across_language | No | ||
| allow_unlabelled_language | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||