[GH-ISSUE #1077] Format for searching song with artist name and song name #636

Closed
opened 2026-02-28 00:00:26 +03:00 by kerem · 2 comments
Owner

Originally created by @Coconut9021 on GitHub (Mar 5, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1077

I'm trying to search for songs using the artist name and song title it works of sometimes but it will occasionally put a song from the correct artist but different song or even the same song name but different artist I'm currently using this format to search is there a more accurate way to get this info
Code_0BRI5wYayl

Originally created by @Coconut9021 on GitHub (Mar 5, 2024). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1077 I'm trying to search for songs using the artist name and song title it works of sometimes but it will occasionally put a song from the correct artist but different song or even the same song name but different artist I'm currently using this format to search is there a more accurate way to get this info ![Code_0BRI5wYayl](https://github.com/spotipy-dev/spotipy/assets/126723591/79d5a66e-a2f2-4387-8c0e-2ac78f617a38)
kerem 2026-02-28 00:00:26 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@stephanebruckert commented on GitHub (Mar 5, 2024):

artist = "artist"
track_name = "song name"
query = 'track:{0} artist:{1}'.format(track_name, artist)
sp.search(query, limit=1, type='track', market=None)
<!-- gh-comment-id:1979324218 --> @stephanebruckert commented on GitHub (Mar 5, 2024): ``` artist = "artist" track_name = "song name" query = 'track:{0} artist:{1}'.format(track_name, artist) sp.search(query, limit=1, type='track', market=None) ```
Author
Owner

@Coconut9021 commented on GitHub (Mar 5, 2024):

Thanks works perfectly

<!-- gh-comment-id:1979410356 --> @Coconut9021 commented on GitHub (Mar 5, 2024): Thanks works perfectly
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#636
No description provided.