Skip to main content

A simple python wrapper to access iTunes Store API

Project description


A simple python wrapper for accessing the iTunes Store API iTunes Store API


To install with pip, just run this in your terminal:

$ pip install pitunes

Or clone the code from Github and:

$ python install


This module caches responses from the iTunes API to speed up repeated queries against the same resources. Note, however, that there's no persistent caching that happens between Python processes. Ie, once a python process exits, the cache is cleared.



from __future__ import print_function
import itunes

# Search band U2
artist = itunes.search_artist('u2')[0]
for album in artist.get_albums():
    for track in album.get_tracks():
        print(, album.url,, track.duration, track.preview_url)

# Search U2 videos
videos ='u2', media='musicVideo')
for video in videos:
    print(, video.preview_url, video.artwork)

# Search Volta album by Björk
album = itunes.search_album('Volta Björk')[0]

# Global Search 'Beatles'
items ='beatles')
for item in items:
    print('[' + item.type + ']', item.artist,, item.url, item.release_date)

# Search 'Angry Birds' game
item ='angry birds', media='software')[0]

# Search 'Family Guy Season 1'
item = itunes.search_season('Family Guy Season 1')[0]

# Search 'Episode 5 of Family Guy Season 1'
items = itunes.search_episode('Family Guy Season 1')
for ep in items:
    if ep.episode_number == 5:

Lookup by iTunes ID

import itunes

# Lookup Achtung Baby album by U2
U2_ACHTUNGBABY_ID = 475390461
album = itunes.lookup(U2_ACHTUNGBABY_ID)


artist = album.artist
tracks = album.get_tracks()

# Lookup song One from Achtung Baby album by U2
U2_ONE_ID = 475391315
track = itunes.lookup(U2_ONE_ID)

artist = track.artist
album = track.get_album()

Lookup by UPC

import itunes

# Lookup Arcade EP by glitch_d using UPC
ARCADE_EP_UPC = 5057917815772
album = itunes.lookup_upc(ARCADE_EP_UPC)


artist = album.artist
tracks = album.get_tracks()


$ py.test tests

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pitunes, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size pitunes-1.1.2-py2-none-any.whl (7.7 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size pitunes-1.1.2-py3-none-any.whl (7.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pitunes-1.1.2.tar.gz (7.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page