npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

itunes-feed

v1.0.0

Published

Generate and retrieve iTunes feeds

Downloads

15

Readme

itunes-feed

npm npm David Travis Coveralls license Beerpay

Generates and retrieves JSON feeds from iTunes for various different services. A programmatic version of the RSS Feed Generator.

Usage

Install

npm install --save itunes-feed

Example

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);
}

API Documentation

itunes-feed ⇒ ITunesFeed

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...
});

ITunesFeed

Class exported from itunes-feed.

Kind: global class

new ITunesFeed([options])

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. |

itunesFeed.ITunesFeed : ITunesFeed

Access to uninstantiated ITunesFeed class for advanced usage.

Kind: instance property of ITunesFeed
Read only: true

itunesFeed.options : Object

Global options set on this instance. You may change these options at any time.

Kind: instance property of ITunesFeed
Example

itunesFeed.options.limit = 50;

itunesFeed.appleMusic([feedType], [options]) ⇒ Promise.<Feed>

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
});

itunesFeed.audioBooks([options]) ⇒ Promise.<Feed>

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();
//=> [...]

itunesFeed.books([feedType], [options]) ⇒ Promise.<Feed>

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();
//=> [...]

itunesFeed.iosApps([feedType], [genre], [options]) ⇒ Promise.<Feed>

Retrieves feed for iOS Apps.

Kind: instance method of ITunesFeed
Returns: Promise.<Feed> - Instance of Feed.
Throws:

  • Error If an invalid genre is provided.
  • Error If the genre is set to 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');

itunesFeed.itunesMusic([feedType], [options]) ⇒ Promise.<Feed>

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();
//=> [...]

itunesFeed.itunesU([options]) ⇒ Promise.<Feed>

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();
//=> [...]

itunesFeed.macApps([feedType], [options]) ⇒ Promise.<Feed>

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();
//=> [...]

itunesFeed.movies([options]) ⇒ Promise.<Feed>

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();
//=> [...]

itunesFeed.musicVideos([options]) ⇒ Promise.<Feed>

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();
//=> [...]

itunesFeed.podcasts([options]) ⇒ Promise.<Feed>

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();
//=> [...]

itunesFeed.tvShows([feedType], [options]) ⇒ Promise.<Feed>

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();
//=> [...]

Feed ⇐ Array

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

feed.title : String

The title of the feed.

Kind: instance property of Feed
Read only: true

feed.url : String

The url of the feed.

Kind: instance property of Feed
Read only: true

feed.countryCode : String

The country code in which this feed is for.

Kind: instance property of Feed
Read only: true

feed.updated : Date

The date when this feed was last updated.

Kind: instance property of Feed
Read only: true

Tests

To run tests locally, clone this repo and run:

npm test

License

MIT License