mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 01:03:53 +00:00
show_featured_artists.py and update publishing docs (#821)
* show_featured_artists.py and update publishing docs * Don't update version Co-authored-by: Stéphane Bruckert <contact@stephanebruckert.com>
This commit is contained in:
parent
61c8cda006
commit
a4cfd83946
13
CHANGELOG.md
13
CHANGELOG.md
@ -6,10 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
* Updated the documentation to specify ISO-639-1 language codes.
|
|
||||||
* Added `market` parameter to `album` and `albums` to address ([#753](https://github.com/plamere/spotipy/issues/753)
|
|
||||||
|
|
||||||
// Add your changes here and then delete this line
|
### Added
|
||||||
|
|
||||||
|
* Added `market` parameter to `album` and `albums` to address ([#753](https://github.com/plamere/spotipy/issues/753)
|
||||||
|
* Added 'show_featured_artists.py' to 'examples'.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Updated the documentation to specify ISO-639-1 language codes.
|
||||||
|
* Fix `AttributeError` for `text` attribute of the `Response` object
|
||||||
|
|
||||||
## [2.20.0] - 2022-06-18
|
## [2.20.0] - 2022-06-18
|
||||||
|
|
||||||
@ -18,7 +24,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
* Changed URI handling in `client.Spotify._get_id()` to remove qureies if provided by error.
|
* Changed URI handling in `client.Spotify._get_id()` to remove qureies if provided by error.
|
||||||
* Added a new parameter to `RedisCacheHandler` to allow custom keys (instead of the default `token_info` key)
|
* Added a new parameter to `RedisCacheHandler` to allow custom keys (instead of the default `token_info` key)
|
||||||
* Simplify check for existing token in `RedisCacheHandler`
|
* Simplify check for existing token in `RedisCacheHandler`
|
||||||
* Fix `AttributeError` for `text` attribute of the `Response` object
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Removed Python 3.5 and added Python 3.9 in Github Action
|
* Removed Python 3.5 and added Python 3.9 in Github Action
|
||||||
|
|||||||
27
examples/show_featured_artists.py
Normal file
27
examples/show_featured_artists.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Shows all artists featured on an album
|
||||||
|
|
||||||
|
# usage: featured_artists.py spotify:album:[album urn]
|
||||||
|
|
||||||
|
from spotipy.oauth2 import SpotifyClientCredentials
|
||||||
|
import sys
|
||||||
|
import spotipy
|
||||||
|
from pprint import pprint
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
urn = sys.argv[1]
|
||||||
|
else:
|
||||||
|
urn = 'spotify:album:5yTx83u3qerZF7GRJu7eFk'
|
||||||
|
|
||||||
|
sp = spotipy.Spotify(client_credentials_manager=SpotifyClientCredentials())
|
||||||
|
album = sp.album(urn)
|
||||||
|
|
||||||
|
featured_artists = set()
|
||||||
|
|
||||||
|
items = album['tracks']['items']
|
||||||
|
|
||||||
|
for item in items:
|
||||||
|
for ele in item['artists']:
|
||||||
|
if 'name' in ele:
|
||||||
|
featured_artists.add(ele['name'])
|
||||||
|
|
||||||
|
pprint(featured_artists)
|
||||||
Loading…
Reference in New Issue
Block a user