mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
* Fixed scripts in examples directory that didn't work, deleted any redundant examples. * Added examples for methods related to audiobooks, shows and episodes * Updated changelog --------- Co-authored-by: Stéphane Bruckert <stephane.bruckert@gmail.com>
29 lines
799 B
Python
29 lines
799 B
Python
"""
|
|
List current user's saved shows
|
|
Usage: user_saved_shows -l <num> -o <num>
|
|
"""
|
|
|
|
import argparse
|
|
import spotipy
|
|
from spotipy.oauth2 import SpotifyOAuth
|
|
|
|
scope = 'user-library-read'
|
|
|
|
def get_args():
|
|
parser = argparse.ArgumentParser(description='Show user\'s saved shows')
|
|
parser.add_argument('-l', '--limit', default=20, help='Num of shows to return')
|
|
parser.add_argument('-o', '--offset', default=0, help='Index of first show to return')
|
|
|
|
return parser.parse_args()
|
|
|
|
def main():
|
|
args = get_args()
|
|
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
|
|
results = sp.current_user_saved_shows(limit=args.limit, offset=args.offset)
|
|
# Print episode names
|
|
for item in results['items']:
|
|
print(item['show']['name'])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main() |