> _ 

c u t u p @ c u t u p . o r g


[googlereader lynx api] last modified: 03/25/2007 02:03 pm

Here's a way to get a count of unread items in google reader in shell. They haven't really released an API yet, and afaik one of the reasons is they only have cookie based auth set up, so it's not as easy as it should be, but this works. It uses lynx and awk.

1) Find lynx.cfg. On my mac with fink it's /sw/etc/lynx.cfg, otherwise probably in /etc somewhere. Find the PERSISTENT_COOKIES line and make sure it's uncommented and set to TRUE.

2) Navigate to google.com/reader, login and accept the cookies, then quit. Now you have the cookie you need wherever your lynx.cfg saves them.

3) Now this shell command:

lynx -dump http://www.google.com/reader/api/0/unread-count?all=true| awk -F\> '/feed/{x=1}/count/{if(x==1)y+=0+$2;x=0}END{print y}'

will print the count of unread items to STDOUT for use in your nefarious projects. I throw it into Geektool.

Anyone know any better way to get this? Seems like there's a 20 digit userID that everyone has - but I haven't found a way to to use that to get this information.

[All Posts] [top]