ポッドキャストも聞けるSpotify(スポティファイ) は、開発者向けのAPIを公開しています。
SpotifyのAPIでPodcastの情報を取得するためのサンプルコードを公開します。
Client IDとClient secret は Spotify for Developers で取得します。
pip install spotipy
などで Python向けのライブラリをインストールします。
import spotipy from spotipy.oauth2 import SpotifyClientCredentials my_id = '' my_secret = '' ccm = SpotifyClientCredentials(my_id, my_secret) spotify = spotipy.Spotify(client_credentials_manager = ccm, language='ja') target = "5vSDpbHdx2YaXQPWzLSFri" results = spotify.show_episodes(target, limit=10, market="JP") episodes = results['items'] while results['next']: results = spotify.next(results) episodes.extend(results['items']) print(len(episodes),"番組取得した")
がんばるます