mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 17:23:53 +00:00
30 lines
800 B
Python
30 lines
800 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() |