View Single Post
Old 07-16-2010, 05:27 AM   #40
rollercoaster
Zealot
rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.rollercoaster once ate a cherry pie in a record 7 seconds.
 
rollercoaster's Avatar
 
Posts: 126
Karma: 1826
Join Date: Jan 2010
Device: Kindle 2
Well it appears there are two methods to do this. The first is straight forward. Lets try it...

After all feeds have been processed, make a GET request to "http://www.google.com/reader/atom/user/-/state/com.google/reading-list?n=1" and from the received XML(see Reference Feed structure) extract the feed id and timestamp values.

Then POST to "http://www.google.com/reader/api/0/mark-all-as-read" with the data "s=<Feed ID>&ts=<TimeStamp in microseconds>&T=<token>" (may need to URI encode values)

Note that this must be done AFTER the articles have been processed/saved as they cannot be downloaded again after successfully marking all as read. If possible, do it after the ebook as been generated and saved successfully so that conversion or other external errors done mess this up.

Reference Feed structure:
Code:
<feed>
  ...
  <id>
    tag:google.com,2005:reader/user/10347379608328268864/state/com.google/reading-list
  </id>
  ...
  <entry gr:crawl-timestamp-msec="1279242802553">
    ...
  </entry>
</feed>

To get the Feed ID: read value at <feed><id>[VALUE]<id>....</feed>
XPATH = //feed/id


To get the Time Stamp: read value at
<feed><entry gr:crawl-timestamp-msec="[VALUE]"></entry>....</feed>
XPATH=//feed/entry[1]/[crawl-timestamp-msec]
Note 1: we only need the time stamp of the FIRST <entry>
Note 2: The value in the feeds is in millisecond but for the "mark-all-as-read" we need microsecond. So to get the right value do this: Microsecond_Time_Stamp = ((MiliSecond_Time_Stamp + 1) * 1000) -1


To get Token value
Execute a GET request for "http://www.google.com/reader/api/0/token" and read the response. it is a 57 chars string.

Final Note 1: All and any requests must include the "Authorization=GoogleLogin auth=<AUTH TOKEN>" header.

------------------------

if this doesnt work then we will have to try the other method that will be more complicated as low performing. I.e. mark individual items as read.

Last edited by rollercoaster; 07-16-2010 at 05:31 AM.
rollercoaster is offline   Reply With Quote