Skip to content

beverlyRoadGoose/ItunesSearch

Repository files navigation

Build Status Coverage Status Codacy Badge GitHub version License

About

This is a Java wrapper for the iTunes Search API.

Usage

Adding the library to your project

Gradle

compile group: 'me.tobiadeyinka', name: 'iTunesSearch', version: '1.5.3'

Maven

<dependency>
    <groupId>me.tobiadeyinka</groupId>
    <artifactId>iTunesSearch</artifactId>
    <version>1.5.3</version>
</dependency>

Making calls to the API

Using Podcast's search as an example, to search for "Radiolab" and leaving all other parameters set to default, it's as simple as:

new PodcastSearch()
    .with("radiolab")
    .execute();

To compare your search term with only a particular attribute, for example the genre of podcasts, you can specify that this way:

new PodcastSearch()
    .with("radiolab")
    .inAttribute(PodcastAttribute.GENRE);
    .execute();

To run your search in only one itunes store, just pass the ISO 3166-1 alpha-2 code for that country, this example uses Nigeria:

new PodcastSearch()
    .with("radiolab")
    .inCountry(CountryCode.NG)
    .execute();

Searching other media types follow the same method. To search every media type in one call, use MediaSearch:

new MediaSearch()
    .with("something")
    .execute();

There are much more configurations available all of which are detailed in the wiki.

To lookup up lists or items from the store, use the lookup API's. For example, to get the top songs in the store:

MusicLookup.topSongs();

To get the top n songs:

MusicLookup.topSongs(n);

The javadoc is also available here. All searches and lookups return a JSON object.

Disclaimer

iTunes is a trademark of Apple Inc., registered in the U.S. and other countries.

This library has not been authorized, sponsored, or otherwise approved by Apple Inc.

License

   Copyright 2018 Oluwatobi Adeyinka

   
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.