Git Product home page Git Product logo

pyapplemusic's Introduction

PyAppleMusic

PyAppleMusic is an API wrapper for the Apple Music API. Unlike most other API wrappers, this one supports Library Resources (as long as you have a Media-User-Token)! Additionally, raw JSON responses are serialized into classes with Pydantic making it easier for developers to work with the API. This project is currently a work-in-progress so only a small subset of endpoints and resources are implemented, but more will come soon.

Usage

from pyapplemusic.AppleMusic import AppleMusicClient

music = AppleMusicClient(dev_token="YOUR APPLE DEVELOPER TOKEN", media_token="YOUR MEDIA USER TOKEN")

# Prints every song in a user's library
all_songs = music.library.get_all_songs()
    has_next = all_songs.next
    while has_next is not None:
        songs = music.library.get_next_songs(has_next)
        has_next = songs.next
        for song in songs.songs:
            print(f"Name: {song.attributes.name}")
            print(f"Artist: {song.attributes.artistName}")
            print("==============================================")

Output

Name: Human Nature
Artist: Michael Jackson
==============================================
Name: HURTWORLD '99
Artist: City Morgue, ZillaKami & SosMula
==============================================
Name: HYFR (Hell Ya F*****g Right) [feat. Lil Wayne]
Artist: Drake
==============================================
Name: Hype Boy
Artist: NewJeans
==============================================
Name: i
Artist: Kendrick Lamar
==============================================
Name: I
Artist: Lil Skies
==============================================
Name: I Can
Artist: Nas
==============================================
Name: I Can't Decide
Artist: Hopsin
==============================================

pyapplemusic's People

Contributors

callmetak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.