WebService::Google::Reader - Perl interface to Google Reader
use WebService::Google::Reader; my $reader = WebService::Google::Reader->new( username => $user, password => $pass, ); my $feed = $reader->unread(count => 100); my @entries = $feed->entries; # Fetch past entries. while ($reader->more($feed)) { my @entries = $feed->entries; }
The WebService::Google::Reader module provides an interface to the Google Reader service through the unofficial (as-yet unpublished) API.
WebService::Google::Reader
Creates a new WebService::Google::Reader object. The following named parameters are accepted:
Required for accessing any personalized or account-related functionality (reading-list, editing, etc.).
Use https scheme for all requests, even when not required.
An optional useragent object.
Enable debugging. Default: 0. This will dump the headers and content for both requests and responses.
Disable compression. Default: 1. This is useful when debugging is enabled and you want to read the response content.
Returns the error, if one occurred.
The following methods request an ATOM feed and return a subclass of XML::Atom::Feed. These methods accept the following optional named parameters:
XML::Atom::Feed
The sort order of the entries: desc (default) or asc in time. When ordering by asc, Google only returns entries within 30 days, whereas the default order has no limitation.
Request entries only newer than this time (represented as a unix timestamp).
Accepts a hash reference to one or more of feed / tag / state. Each of which is a scalar or array reference.
Accepts a single feed url.
Accepts a single tag name. See "TAGS"
Accepts a single state name. See "STATES".
Shortcut for state('broadcast').
Shortcut for state('starred').
Shortcut for state('reading-list', exclude => { state => 'read' })
Shortcut for state('like').
Accepts a query string and the following named parameters:
One or more (as a array reference) feed / state / tag to search. The default is to search all feed subscriptions.
The total number of search results: defaults to 1000.
The number of entries per fetch: defaults to 40.
The sort order of the entries: desc (default) or asc in time.
A feed generator only returns $count entries. If more are available, calling this method will return a feed with the next $count entries.
The following methods return an object of type WebService::Google::Reader::ListElement.
WebService::Google::Reader::ListElement
Returns a list of subscriptions and a count of unread entries. Also listed are any tags or states which have positive unread counts. The following accessors are provided: id, count. The maximum count reported is 1000.
Returns the list of user subscriptions. The following accessors are provided: id, title, categories, firstitemmsec. categories is a reference to a list of ListElements providing accessors: id, label.
ListElement
Returns the list of preference settings. The following accessors are provided: id, value.
Returns the list of user-created tags. The following accessors are provided: id, shared.
Returns the list of user information. The following accessors are provided: isBloggerUser, userId, userEmail.
The following methods are used to edit feed subscriptions.
Requires a feed url or Feed object, or a reference to a list of them. The following named parameters are accepted:
Flag indicating whether the target feeds should be added or removed from the user's subscriptions.
Accepts a title to associate with the feed. This probaby wouldn't make sense to use when there are multiple feeds. (Maybe later will consider allowing a list here and zipping the feed and title lists).
Accepts a tag / state or a reference to a list of tags / states for which to associate / unassociate the target feeds.
Associate / unassociate a list of tags / states from a feed / feeds.
Subscribe or unsubscribe from a list of feeds.
Renames a feed to the given title.
Marks the feeds as read.
The following methods are used to edit tags and states.
Accepts the following parameters.
Make the given tags / states public.
Make the given tags / states private.
Only tags (and not states) can be disabled.
Associate / unassociate the 'broadcast' state with the given tags / states.
Delete the given tags.
Renames the tags associated with any feeds.
Renames the tags associated with any individual entries.
Calls rename_feed_tag and rename_entry_tag, and finally delete_tag.
Marks all entries as read for the given tags / states.
The following methods are used to edit individual entries.
Associate / unassociate the entries with the given tags / states.
Marks all the given entries as "broadcast".
Marks / unmarks all the given entries as "starred".
Marks all the given entries as "read".
Marks / unmarks all the given entries as "liked".
These are a list of other useful methods.
Sets the given preference name to the given value.
Exports feed subscriptions as OPML.
Returns true / false on success / failure. Unsure of when this needs to be used.
The following private methods may be of use to others.
This is automatically called from within methods that require authorization. An optional parameter is accepted which when true, will force a login even if a previous login was successful. The end result of a successful login is to set the auth token.
Given an HTTP::Request, this will perform the request and if the response indicates a bad (expired) token, it will request another token before performing the request again. Returns an HTTP::Response on success, false on failure (check error).
HTTP::Request
HTTP::Response
This is automatically called from within methods that require a user token. If successful, the token is available via the token accessor.
Returns a list of all the known states. See "STATES".
The following characters are not allowed: "<>?&/\^
These are tags in a Google-specific namespace. The following are all the known used states.
Entries which have been read.
Entries which have been read, but marked unread.
New entries from reading-list.
Entries which have been starred.
Entries which have been shared and made publicly available.
Entries from all subscriptions.
Entries for which a link in the body has been clicked.
Entries which have been mailed.
Entries for which the title link has been clicked.
Entries which have been kept unread. (Not sure how this differs from "kept-unread").
http://code.google.com/p/pyrfeed/wiki/GoogleReaderAPI
Please report any bugs or feature requests to http://rt.cpan.org/Public/Bug/Report.html?Queue=WebService-Google-Reader. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc WebService::Google::Reader
You can also look for information at:
GitHub Source Repository
http://github.com/gray/webservice-google-reader
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WebService-Google-Reader
CPAN Ratings
http://cpanratings.perl.org/d/WebService-Google-Reader
RT: CPAN's request tracker
http://rt.cpan.org/Public/Dist/Display.html?Dist=WebService-Google-Reader
Search CPAN
http://search.cpan.org/dist/WebService-Google-Reader
Copyright (C) 2007-2011 gray <gray at cpan.org>, all rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
gray, <gray at cpan.org>
To install WebService::Google::Reader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Google::Reader
CPAN shell
perl -MCPAN -e shell install WebService::Google::Reader
For more information on module installation, please visit the detailed CPAN module installation guide.