fanboy

cache itunes search

fanboy - cache itunes search

The fanboy Node.js package implements a cache for parts of the iTunes Search API.

var fanboy = require('fanboy')
var levelup = require('levelup')
 
var cache = fanboy({media:'podcast', db:levelup('/tmp/fanboy')})
var search = cache.search()
search.end('merlin mann')
search.pipe(process.stdout)
$ node example/search.js | json
var lookup = cache.lookup()
lookup.end('471418144')
lookup.pipe(process.stdout)
$ node example/lookup.js | json
var suggest = cache.suggest()
suggest.end('m')
suggest.pipe(process.stdout)
$ node example/suggest.js | json

The options for the fanboy cache:

  • country String which defaults to 'us'
  • db The mandatory LevelUP instance
  • hostname String which defaults to 'itunes.apple.com'
  • media String which defaults to 'all'
  • method String which defaults to 'GET'
  • path String which defautls to '/search'
  • port Number which defaults to 80
  • readableObjectMode Boolean which defaults to false
  • reduce function which defaults to the lib/reduce module
  • ttl Time to live in milliseconds Number which defaults to 86400000

The fanboy module exports a single function that returns a new cache object (an instance of the Fanboy class). To access the Fanboy class require('fanboy').

var fanboy = require('fanboy')
var cache = fanboy(opts())

Transform stream where input is search terms as String or Buffer and output is search results as JSON Buffer or Object.

Transform stream where input is guids as String or Buffer and output is search results as JSON Buffer or Object.

Transform stream where input is search terms as String or Buffer and output is search terms as JSON Buffer or String.

With npm do:

$ npm install fanboy

MIT License