ocelma / python-itunes Goto Github PK
View Code? Open in Web Editor NEWA simple python wrapper to access iTunes Store API http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
A simple python wrapper to access iTunes Store API http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
Is there any limit to number of search queries (items = itunes.search(query=song_name)
) made with itunes api as i am getting this error after processing for songs greater than 47 in a row.
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "itunes/__init__.py", line 677, in search offset=offset, order=order, country=store).get() File "itunes/__init__.py", line 149, in get self._json_results = self._request(cacheable=is_caching_enabled()) File "itunes/__init__.py", line 140, in _request return _Request(method_name, params).execute(cacheable) File "itunes/__init__.py", line 96, in execute raise self._get_error(e.fp.read()) pyitunes.ServiceException: Error:
Once i get this error, it throws back same unexpectedly on any other further made query.
What is the real issue behind this and how to avoid this (if possible) ?
Loving the package, but just wondering what the purpose of the clean_json
method is? It's breaking encoded characters (i.e. \u2019
).
i wanna get the lyrics of the song from the api how ca i get it please help
After a could of requests i got a "unbound local variable: Variable id is referenced before assignment" exception for "lookup" method.
By the way, thanks for sharing this library on git :)
Hi,
I'm trying to store the Song ID and I get the error
songid = track.get_id()
AttributeError: 'str' object has no attribute 'get_id'
I also get this on the Duration
track_duration = track.get_duration()
Any help would be greatly appriciated
First of all, thank you for this package - it's excellent.
Since python-itunes requires simplejson - I think setup.py
should require it:
setup(
name = "python-itunes",
...
packages=['itunes'],
install_requires = ['simplejson']
)
Alternatively, you could change from simplejson
to json
, which is available as a standard module as of python 2.6 and only require simplejson
if python-itunes
is installed in a version `< 2.6'.
Thank you.
The library seems to require a collectionPrice
key in search responses, which may not be present:
>>> import itunes
>>> itunes.search_album('bar')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "itunes/__init__.py", line 605, in search_album
limit=limit, offset=offset, order=order, country=store).get()
File "itunes/__init__.py", line 181, in get
item._set(json)
File "itunes/__init__.py", line 398, in _set
self.price = round(json['collectionPrice'] or 0, 4)
KeyError: 'collectionPrice'
A simple solution would be to check for they's presence and emit a null value if it's missing.
Python 2.7.13 (default, Dec 18 2016, 07:03:39)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import itunes
>>> itunes.search_artist('health')[0].get_albums()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build/bdist.macosx-10.12-x86_64/egg/itunes/__init__.py", line 334, in get_albums
File "build/bdist.macosx-10.12-x86_64/egg/itunes/__init__.py", line 174, in get
File "build/bdist.macosx-10.12-x86_64/egg/itunes/__init__.py", line 377, in _set
KeyError: 'collectionPrice'
>>>
Seems similar to #12, not sure if it's related.
When installing for python 3+ you will get an error on line 94 https://github.com/ocelma/python-itunes/blob/master/itunes/__init__.py#L94
Thanks for your lib.
One good feature would be to be able to change the lang ;)
I have a loop on a search where I need to check to see if I found a match, it not the Artist/Album, etc object can be set to None if not found. When comparing these objects to None the eq and ne methods blow up with:
AttributeError: 'NoneType' object has no attribute 'id'
Please find the attached patch that resolves this issue.
none-patch.txt
This issue is slightly different than #7 .
easy_install
works, but when I run pip install python-itunes
, I also get the error "No distributions at all found for python-itunes".
But in the log, I saw this:
Downloading/unpacking python-itunes
Getting page http://pypi.python.org/simple/python-itunes
URLs to search for versions for python-itunes:
* http://pypi.python.org/simple/python-itunes/
Getting page http://pypi.python.org/simple/python-itunes/
Analyzing links from page https://pypi.python.org/simple/python-itunes/
Skipping link https://pypi.python.org/packages/source/p/python-itunes/python-itunes.tar.gz#md5=6690e8a261d3486b90763e3281842c1b (from https://pypi.python.org/simple/python-itunes/); wrong project name (not python-itunes)
Skipping link http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html (from https://pypi.python.org/simple/python-itunes/); unknown archive format: .html
Could not find any downloads that satisfy the requirement python-itunes
Note that in line 7 it's skipping the tar.gz package link with the message "wrong project name (not python-itunes)". I think that if you remove the "#md5=..." after the file name, it will work.
If fact, this works:
pip install https://pypi.python.org/packages/source/p/python-itunes/python-itunes.tar.gz
Thanks for the package!
Hi, this is not an issues as much as a question about the capabilities of this wrapper api.
I want to get JSON results from the iTunes search api, which includes the previewURL for a certain song. (i want to only search for songs).
Here is an example output from iTunes that I want to get:
SRC: [https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/]
{"wrapperType":"track",
"kind":"song",
"artistId":909253,
"collectionId":120954021,
"trackId":120954025,
"artistName":"Jack Johnson",
"collectionName":"Sing-a-Longs and Lullabies for the Film Curious George",
"trackName":"Upside Down",
"collectionCensoredName":"Sing-a-Longs and Lullabies for the Film Curious George",
"trackCensoredName":"Upside Down",
"artistViewUrl":"https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewArtist?id=909253",
"collectionViewUrl":"https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=120954025&id=120954021&s=143441",
"trackViewUrl":"https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=120954025&id=120954021&s=143441",
"previewUrl":"http://a1099.itunes.apple.com/r10/Music/f9/54/43/mzi.gqvqlvcq.aac.p.m4p",
"artworkUrl60":"http://a1.itunes.apple.com/r10/Music/3b/6a/33/mzi.qzdqwsel.60x60-50.jpg",
"artworkUrl100":"http://a1.itunes.apple.com/r10/Music/3b/6a/33/mzi.qzdqwsel.100x100-75.jpg",
"collectionPrice":10.99,
"trackPrice":0.99,
"collectionExplicitness":"notExplicit",
"trackExplicitness":"notExplicit",
"discCount":1,
"discNumber":1,
"trackCount":14,
"trackNumber":1,
"trackTimeMillis":210743,
"country":"USA",
"currency":"USD",
"primaryGenreName":"Rock"}
Any ideas? Thanks in advance
pip install of python-itunes always fails for me with the message:
Downloading/unpacking python-itunes
Could not find any downloads that satisfy the requirement python-itunes
No distributions at all found for python-itunes
I'm wondering if something is wrong with the package on PyPI? Below is some more detailed information from the pip log.
Downloading/unpacking python-itunes
Getting page http://pypi.python.org/simple/python-itunes
URLs to search for versions for python-itunes:
* http://pypi.python.org/simple/python-itunes/
Getting page https://github.com/ocelma/python-itunes
Analyzing links from page http://pypi.python.org/simple/python-itunes/
Skipping link http://pypi.python.org/packages/source/p/python-itunes/python-itunes.tar.gz#md5=6690e8a261d3486b90763e3281842c1b (from http://pypi.python.org/simple/python-it\
unes/); wrong project name (not python-itunes)
Skipping link https://github.com/ocelma/python-itunes (from http://pypi.python.org/simple/python-itunes/); not a file
Skipping link http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html (from http://pypi.python.org/simple/python-itunes/); u\
nknown archive format: .html
Analyzing links from page https://github.com/ocelma/python-itunes
Skipping link https://github.com/opensearch.xml (from https://github.com/ocelma/python-itunes); unknown archive format: .xml
Skipping link https://github.com/fluidicon.png (from https://github.com/ocelma/python-itunes); unknown archive format: .png
...
This may be implemented already, but I don't see a way to return URLs that have iTunes affiliate tracking from LinkShare. For example:
If anyone has done this, please share. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.