Search code examples
rssfeedgoogle-reader

Does google reader api have method return each oldest entry's timestamp of feed?


Does google reader api have method return each oldest entry's timestamp of feed? method "unread-count" just return newest timestamp. method "subscriptions" just return oldest timestamp for entry what is not unread.


Solution

  • I haven't seen any service in the API that can give you exactly what you want right away.

    Even though I have some ideas that may help you (see ahead), you have to take into account the nature of Google Reader and RSS feeds. These technologies are intended as sync/info-transfer 'helpers', for native or web clients that will cache this info and will use timestamps for optimization. This means a focus on 'anything more recent than' events. The use case you're asking for is not so common for this kind of usage, but you may still ask for an arbitrarily old date.

    Also, you can get some feeds where you can 'go back in time' for a long time (assuming you're accessing the feed directly and not some client cached version of it), but others (think about feeds where you get 100+ items per day) often rely on mechanisms that only retrieve info that goes back for a not-so-long time period (otherwise we'd be talking about data that can go into the 100s or 1000s MBs of storage and transfer).

    Anyway, the ones that can help you the best will probably be:

    • http://www.google.com/reader/api/0/stream/items/ids (returns the N most recent ids on a stream, and you can filter this by read, unread, starred, etc.). You'll probably need to do a call with a large number of results and then store the result you get. You'll probably run into timeouts on the server side (I've used this API succesfully for 20000 items before). Even like this, you may not get the 'oldest' result ever...
    • http://www.google.com/reader/atom/user/-/state/com.google/read . You can also filter this one for reads, unreads, starred, etc. Also it allows defining the number of items to return. I've never used this one, but it contains a parameter (c, for continuation) that can be promising for what you need. As described here (in the 'Atom set of items' section):

    a string used for continuation process. Each feed return not all items, but only a certain number of items. You'll find in the atom feed (under the name gr:continuation) a string called continuation. Just add that string as argument for this parameter, and you'll retrieve next items.

    To finalize, there may be some other methods in the API that I don't know of. Remember this is an unnoficial API. You should ask here - there are lots of answers from Google employees.

    Hope it helps!