NAME

LWP::UserAgent::iTMS_Client - libwww-perl client for Apple iTunes music store

SYNOPSIS

use LWP::UserAgent::iTMS_Client;

# search the Store

my $ua = LWP::UserAgent::iTMS_Client->new(
  user_id => 'me@you', password => 'pwd');
my $listings = $ua->search( song => 'apples' );
foreach my $album (@{$listings}) { print $album->{songName} }

# get my authorization keys

my $ua = new LWP::UserAgent::iTMS_Client(
    account_type => 'apple',
    user_id => 'name@email.org',
    password => 'password',
    DEBUG => 1,
    ds_id => 71111111,
);
$ua->retrieve_keys_from_iTMS;

DESCRIPTION

This perl module implements a user agent which can interact with the Apple iTunes Music Store (iTMS). In the long run, we envision a Perl extension that will allow automated browsing and purchasing of music. For example, the module might be used to automatically get samples of new albums by a particular artist, or buy everything on a Top Ten list weekly.

LWP::UserAgent::iTMS_Client is a sub-class of LWP::UserAgent and implements the methods of UserAgent, but does so using Apple's officially undocumented protocols. Because these protocols change with revisions to iTunes, the modules may occasionally lag Apple's changes until this module, too, is updated.

The initial versions of this user agent will concentrate on browsing the listings and obtaining the user's keys.

METHODS (to be finished later)

new
# set up new instance for anon search
my $ua = 
  LWP::UserAgent::iTMS_Client->new(user_id => 'me@you', password => 'pwd');

# set up for login
my $ua = new LWP::UserAgent::iTMS_Client(
    account_type => 'apple',
    user_id => 'name@email.org',
    password => 'password',
    DEBUG => 1,
    gu_id => 'CF1121F1.13F11411.11B1F151.1611F111.1DF11711.11811F19.1011F1A1',
);

Create a new LWP::UserAgent::iTMS_Client object. Options are: account_type Either 'apple' or 'aol', this determines where the authentication password is to be checked--on an AOL user database or with Apple's accounts.

user_id (required)
    User name, usually an email address.
    
ds_id 
    A user identifier used by iTMS for authentication. May be useful if
    accessing local key files.
    
gu_id 
    A user's machine identifier used by iTMS for authorization.
    
password (required)
    The user's own (user typed, in iTunes) password.
    
DEBUG 
    A flag to cause debugging information to be printed to stdout.

deauth_wait_secs
  Reserved, not currently implemented. 
  This is to be a mandatory wait before deauthorizing a machine.
  
country 
    The country where the user's account is based. Determines purchase 
    currency, etc.

home_dir 
    The directory where the drms keys subdirectory is located. Generally it
    may be best to allow the module to locate this by default.
    
maybe_dot 
    Determines if the drms subdirectory is called '.drms' or 'drms', again,
    best left to the default.

path_sep
    Generally '/'. Path separator for the local OS.
request
retrieve_keys_from_iTMS
deauthorize_gu_id

BUGS

This is a development version, so no doubt there are lots of bugs. For starters, the searches only work with 'song' and 'all' at the moment. Making LWP look on the internet like a recent copy of iTunes is a bit of a moving target. Please don't use up your 5 iTunes machines with this module, fail to save your guID strings, have to call iTMS to wipe your authorizations and start over, and then blame us. That is what the deauthorize_gu_id routine is for.

SEE ALSO ON CPAN

LWP::UserAgent, Audio::M4P::QuickTime, Audio::M4P::Decrypt, Mac::iTunes, Net::iTMS

AUTHOR

William Herrera wherrera@skylightview.com.

SUPPORT

Questions, feature requests and bug reports should go to <wherrera@skylightview.com>.

COPYRIGHT

Copyright (c) 2003-2005 William Herrera. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 553:

'=item' outside of any '=over'

Around line 618:

You forgot a '=back' before '=head1'

Around line 630:

'=item' outside of any '=over'

Around line 632:

You forgot a '=back' before '=head1'