iTunes Feed generator and crawler for Node
MIT License
Generates and retrieves JSON feeds from iTunes for various different services. A programmatic version of the RSS Feed Generator.
npm install --save itunes-feed
const itunesFeed = require('itunes-feed');
// ...
try {
let feed = await itunesFeed.appleMusic();
console.log(`Retrieved ${feed.length} items for Apple Music`);
// ...
} catch(error) {
console.error(error);
}
Returns: ITunesFeed - Instance of ITunesFeed. Example
// Basic usage
const itunesFeed = require('itunes-feed');
// Advanced usage
const ITunesFeed = require('itunes-feed').ITunesFeed;
const itunesFeed = new ITunesFeed({
// options...
});
Class exported from itunes-feed.
Kind: global class
Creates a new instance of ITunesFeed.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object | {} | Optional object for configuring ITunesFeed. These options can be set on the instance (this.options ). |
[options.countryCode] | String | 'us' | 2 letter country code to use for all requests. Must be lowercase. |
[options.limit] | Number | 100 | Limit of items returned in a feed. Must be one of: 10 , 25 , 50 or 100 . Any other value will throw an error. |
[options.explicit] | Boolean | true | Whether to include explicit results. |
[options.axiosOptions] | Object | Object containing additional options to pass to axios. |
Access to uninstantiated ITunesFeed class for advanced usage.
Kind: instance property of ITunesFeed Read only: true
Global options set on this instance. You may change these options at any time.
Kind: instance property of ITunesFeed Example
itunesFeed.options.limit = 50;
Retrieves feed for Apple Music.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[feedType] | String | 'top-songs' | The type of feed to retrieve. Must be one of: coming-soon , hot-tracks , new-releases , top-albums , top-songs . |
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.appleMusic();
//=> [...]
let feed = await itunesFeed.appleMusic('hot-tracks', {
explicit: false
});
Retrieves feed for Audiobooks.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.audioBooks();
//=> [...]
Retrieves feed for Books.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[feedType] | string | "'top-free'" | The type of feed to retrieve. Must be one of: top-free , top-paid . |
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.books();
//=> [...]
Retrieves feed for iOS Apps.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Throws:
games
on a feed type that is not top-free
or top-paid
.Param | Type | Default | Description |
---|---|---|---|
[feedType] | string | "'top-free'" | The type of feed to retrieve. Must be one of: new-apps-we-love , new-games-we-love , top-free , top-free-ipad , top-grossing , top-grossing-ipad , top-paid . |
[genre] | string | "'all'" | Optional genre to retrieve. The only available genres are all and games . The games genre is only available on top-free and top-paid feed types. |
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.iosApps();
//=> [...]
let feed = await itunesFeed.iosApps('top-paid', 'games');
Retrieves feed for iTunes Music.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[feedType] | string | "'top-songs'" | The type of feed to retrieve. Must be one of: new-music , recent-releases , top-albums , top-songs . |
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.itunesMusic();
//=> [...]
Retrieves feed for iTunes U.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.itunesU();
//=> [...]
Retrieves feed for MacOS Apps.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[feedType] | string | "'top-mac-apps'" | The type of feed to retrieve. Must be one of: top-free-mac-apps , top-grossing-mac-apps , top-mac-apps , top-paid-mac-apps . |
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.macApps();
//=> [...]
Retrieves feed for Movies.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.movies();
//=> [...]
Retrieves feed for Music Videos.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.musicVideos();
//=> [...]
Retrieves feed for Podcasts.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.podcasts();
//=> [...]
Retrieves feed for TV Shows.
Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed
.
Param | Type | Default | Description |
---|---|---|---|
[feedType] | string | "'top-tv-episodes'" | The type of feed to retrieve. Must be one of: top-tv-episodes , top-tv-seasons . |
[options] | Object | {} | Any options from ITunesFeed to overwrite for this request. |
Example
let feed = await itunesFeed.tvShows();
//=> [...]
Data wrapper for feed responses. Returns an array of results from the feed with additional properties available on the prototype.
Kind: global class Extends: Array
The title of the feed.
Kind: instance property of Feed Read only: true
The url of the feed.
Kind: instance property of Feed Read only: true
The country code in which this feed is for.
Kind: instance property of Feed Read only: true
The date when this feed was last updated.
Kind: instance property of Feed Read only: true
To run tests locally, clone this repo and run:
npm test
MIT License