<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: retrieving genre of track in metadata in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5499155#M7861</link>
    <description>&lt;P&gt;Hi TionEye,&lt;/P&gt;&lt;P&gt;Do you get any errors?&lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2023 06:17:49 GMT</pubDate>
    <dc:creator>Ximzend</dc:creator>
    <dc:date>2023-02-03T06:17:49Z</dc:date>
    <item>
      <title>retrieving genre of track in metadata</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5495626#M7772</link>
      <description>&lt;P&gt;&lt;STRONG&gt;My Question or Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I'm writing a scritpt to try to retrieve the genre from a track using the metadata of that song. I am not well versed in the spotify API, so i do need some information&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;.&lt;BR /&gt;btw i am writing it in Python and I'm using spotipy to access the API.&lt;BR /&gt;&lt;BR /&gt;My question would be:&lt;BR /&gt;Is it even possible to retrieven the genre of a certian track? (bc it doesn't seem to work for me lol). If yes, how?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2023 21:13:32 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5495626#M7772</guid>
      <dc:creator>user-removed</dc:creator>
      <dc:date>2023-01-27T21:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving genre of track in metadata</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5495796#M7779</link>
      <description>&lt;P&gt;At Spotify, tracks don't have genres, but artists do have them.&lt;/P&gt;&lt;P&gt;Here is code to get genre information of a single track:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

CLIENT_ID = "your_client_id"
CLIENT_SECRET = "your_client_secret"

track_id = "TRACK_ID"

sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id=CLIENT_ID,client_secret=CLIENT_SECRET))

track_data = sp.track(track_id)

artist_ids = []

for artist in track_data["artists"]:
    artist_ids.append(artist["id"])

artists_data = sp.artists(artist_ids)

genres = []

for artist in artists_data["artists"]:
    genres += artist["genres"]

genres = set(genres) # removes duplicates

print(genres)&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 28 Jan 2023 11:30:14 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5495796#M7779</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-01-28T11:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving genre of track in metadata</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5495885#M7780</link>
      <description>&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jan 2023 13:16:36 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5495885#M7780</guid>
      <dc:creator>user-removed</dc:creator>
      <dc:date>2023-01-28T13:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving genre of track in metadata</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5498954#M7846</link>
      <description>&lt;P&gt;Hello, I have implemented this into my code and&amp;nbsp; I don't know why, it always gets stuck in the line:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;'artists_data&amp;nbsp;=&amp;nbsp;sp.artists&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;artist_ids&lt;/SPAN&gt;&lt;SPAN&gt;)'&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Can someone help me please? thanks for your time.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Feb 2023 22:18:04 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5498954#M7846</guid>
      <dc:creator>TionEye</dc:creator>
      <dc:date>2023-02-02T22:18:04Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving genre of track in metadata</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5499155#M7861</link>
      <description>&lt;P&gt;Hi TionEye,&lt;/P&gt;&lt;P&gt;Do you get any errors?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 06:17:49 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5499155#M7861</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2023-02-03T06:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: retrieving genre of track in metadata</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5596586#M9626</link>
      <description>&lt;P&gt;This is extremely frustrating because this issue has existed since atleast 2015 and the docs still show in their examples that you can get genres from tracks and albums. But that's a flat out lie. After dozens of github issue requests and dozens more on this newer platform for issue tracking, nobody has gave a single care to address this in almost 10 years. All that has to be done is to remove 1 line from the example requests for tracks and albums and no more questions about this topic will come up.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 19:03:25 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/retrieving-genre-of-track-in-metadata/m-p/5596586#M9626</guid>
      <dc:creator>ryzeus</dc:creator>
      <dc:date>2023-06-15T19:03:25Z</dc:date>
    </item>
  </channel>
</rss>

