All Projects → sleepyfran → Itunespy

sleepyfran / Itunespy

Licence: mit
🐍 A simple library to fetch data from the iTunes Store API made for Python >= 3.5

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Itunespy

Itunes Iap
Apple iTunes In-app purchase verification tool
Stars: ✭ 126 (+168.09%)
Mutual labels:  itunes, pypi
Senpai
💨Making communication📞easier and faster🚅for all 👦 + 👧 + 👴 + 👶 + 🐮 + 🐦 + 🐱
Stars: ✭ 43 (-8.51%)
Mutual labels:  pypi
Papago
PAPAGO translate API with Python
Stars: ✭ 18 (-61.7%)
Mutual labels:  pypi
Jetson stats
📊 Simple package for monitoring and control your NVIDIA Jetson [Xavier NX, Nano, AGX Xavier, TX1, TX2]
Stars: ✭ 908 (+1831.91%)
Mutual labels:  pypi
Elyra
Elyra extends JupyterLab Notebooks with an AI centric approach.
Stars: ✭ 839 (+1685.11%)
Mutual labels:  pypi
Python Pixabay
Python 3 Pixabay's API wrapper.
Stars: ✭ 32 (-31.91%)
Mutual labels:  pypi
Sen
Terminal User Interface for docker engine
Stars: ✭ 835 (+1676.6%)
Mutual labels:  pypi
Pandoraplayer
🅿️ PandoraPlayer is a lightweight music player for iOS, based on AudioKit and completely written in Swift.
Stars: ✭ 1,037 (+2106.38%)
Mutual labels:  itunes
Teslatunes
Copy your iTunes library, automatically converting Apple Lossless to flac, to a destination for use with your Tesla Model S
Stars: ✭ 37 (-21.28%)
Mutual labels:  itunes
Socli
Stack overflow command line client. Search and browse stack overflow without leaving the terminal 💻
Stars: ✭ 911 (+1838.3%)
Mutual labels:  pypi
Github Trending Cli
A Python package which lists trending repositories and developers from Github
Stars: ✭ 15 (-68.09%)
Mutual labels:  pypi
Itunes smartplaylist
iTunes Smart playlist parser with Python. Convert to Kodi xsp smart playlists.
Stars: ✭ 10 (-78.72%)
Mutual labels:  itunes
Graphql Music
🎸A workshop in building a GraphQL API
Stars: ✭ 33 (-29.79%)
Mutual labels:  itunes
Itunescontrol
[Unmaintained] Global Hotkeys for iTunes
Stars: ✭ 23 (-51.06%)
Mutual labels:  itunes
Retroactive
Run Aperture, iPhoto, and iTunes on macOS Big Sur and macOS Catalina. Xcode 11.7 on macOS Mojave. Final Cut Pro 7, Logic Pro 9, and iWork ’09 on macOS Mojave or macOS High Sierra.
Stars: ✭ 1,027 (+2085.11%)
Mutual labels:  itunes
Pandoc Latex Tip
A pandoc filter for adding tip in LaTeX
Stars: ✭ 7 (-85.11%)
Mutual labels:  pypi
Youtube Dl Gui
A cross platform front-end GUI of the popular youtube-dl written in wxPython.
Stars: ✭ 7,914 (+16738.3%)
Mutual labels:  pypi
Moderngl
Modern OpenGL binding for python
Stars: ✭ 958 (+1938.3%)
Mutual labels:  pypi
Python Datamuse
Python 3 wrapper for the Datamuse API
Stars: ✭ 47 (+0%)
Mutual labels:  pypi
Lexicon
Manipulate DNS records on various DNS providers in a standardized way.
Stars: ✭ 1,028 (+2087.23%)
Mutual labels:  pypi

itunespy PyPI version

itunespy is a simple library to fetch data from the iTunes Store API made for Python 3.5 and beyond.

Important: Since version 1.6 itunespy no longer supports versions below Python 3.5. You can still use any previous versions but those won't get any further updates or features.

Installing

You can install it from pip:

pip install itunespy

Or you can simply clone this project anywhere in your computer:

git clone https://github.com/sleepyfran/itunespy.git

And then enter the cloned repo and execute:

python setup.py install

Dependencies

itunespy requires Requests and pycountry installed.

Examples and information

Search an artist and show all its album's names:

import itunespy

artist = itunespy.search_artist('Steven Wilson')  # Returns a list
albums = artist[0].get_albums()  # Get albums from the first result

for album in albums:
    print(album.collection_name)

Or search an album and show all its song's names and length, and finally the album length:

import itunespy

album = itunespy.search_album('One Hour By The Concrete Lake')  # Returns a list
tracks = album[0].get_tracks()  # Get tracks from the first result

for track in tracks:
    print(track.artist_name + ': ' + track.track_name + str(track.get_track_time_minutes()))
print('Total playing time: ' + str(album[0].get_album_time()))

Or search for a track:

import itunespy

track = itunespy.search_track('Iter Impius')  # Returns a list
print(track[0].artist_name + ': ' + track[0].track_name + ' | Length: ' + str(track[0].get_track_time_minutes())) # Get info from the first result

Or ebook authors:

import itunespy

author = itunespy.search_book_author('Fyodor Dostoevsky')  # Search for Dostoevsky

books = author[0].get_books()  # Get books from the firs result

for book in books:
    print(book.track_name)  # Show each book's name

Or software:

import itunespy

telegram = itunespy.search_software('Telegram')

print(telegram[0].track_name)  # Prints 'Telegram Messenger'

Basically, every search_ method is just an alias for a general search with certain parameters to make your life easier.

I made the basic ones, if you miss any, make an issue and provide information about the type you want added.

You can also perform a lookup:

import itunespy

lookup = itunespy.lookup(upc=720642462928) # Lookup for the Weezer's album 'Weezer'

for item in lookup:
    print(item.artist_name + ': ' + item.collection_name)

Since every search or lookup can return more than one object type, every object in the returned list has a 'type' property, so you can check if it's an artist, album or track like this:

import itunespy

lookup = itunespy.lookup(id=428011728)  # Steven Wilson's ID

for l in lookup:
    if l.type == 'artist':
        print('Artist!')
        print(l.artist_type)  # Since it's an artist, you can also check its artist type

For a complete list, take a look at the wrapperType and kind documentation in the iTunes API's site.

Each request has some parameters that you need to know. Searches has these:

term: The URL-encoded text string you want to search for. Example: Steven Wilson.
        The function will take care of spaces so you don't have to.
country: The two-letter country code for the store you want to search.
        For a full list of the codes: http://en.wikipedia.org/wiki/%20ISO_3166-1_alpha-2
media: The media type you want to search for. Since this module is made for music I recommend leaving it blank.
entity: The type of results you want returned, relative to the specified media type. Example: musicArtist.
        Full list: musicArtist, musicTrack, album, musicVideo, mix, song
attribute: The attribute you want to search for in the stores, relative to the specified media type.
limit: The number of search results you want the iTunes Store to return.

Note: Only the term is obligatory, the other ones have default values that will be used in case you don't provide any. Note 2: In specific searches, like search_artist or search_album, etc, don't change entity, since it's configured inside the function to retrieve an specific entity.

For lookups, the same parameters apply except for term, which changes to a couple of id fields:

id: iTunes ID of the artist/album/track
artist_amg_id: All Music Guide ID of the artist
upc: UPCs/EANs

Every search and lookup will always return a list of result_item instances, except if it's an artist, album, movie artist or an ebook author, which inheritates from result_item but has extra methods, like get_albums in music_artist. Each object has their own variables, following the iTunes API names adapted to Python syntax.

To take a look at all of this simply go to the item_result class.

Contributing

I'm accepting any pull request to improve or fix anything in the library, just fork the project and hack it!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].