Google Reader API?

Is there any Google Reader API that I can connect to? I am building a pure RSS / Atom reader in PHP and would like to get all the benefits of Google Reader, like feed history, the ability to add comments to each feed item, etc.

+3
source share
3 answers

I built some integration with Google Reader in python, but I can share some api knowledge so you can get started. output = json is also available to everyone.

Login: https www.google.com/accounts/ClientLogin

POST & email = email & passwd = password & service = reader & source = appname & continue = http://www.google.com

from capturing answer Auth =

: www.google.com/reader/api/0/token

HEADER = GoogleLogin auth = $Auth

$ .

- URL-, auth querystring post.

: www.google.com/reader/api/0/subscription/list?output=xml

, url -

www.google.com/reader/api/0/subscription/edit?pos=0&client=$source

POST : s = $streams & t = $title & T = $token & ac = subscribe

POST : s = $stream & T = $token & ac = unsubscribe

$stream, , feed/$feedurl, techcrunch, feed/http://feeds.feedburner.com/Techcrunch

, URL-, .

+9

python:

import urllib, urllib2
import json, pprint

email, password = 'jose@gmail.com', 'nowayjose'
clientapp, service = 'reader', 'reader'

params = urllib.urlencode({'Email': email, 'Passwd': password, 'source': clientapp, 'service': service})
req = urllib2.Request(url='https://www.google.com/accounts/ClientLogin', data=params)
f = urllib2.urlopen(req)

for line in f.readlines():
  if line[0:5] == 'Auth=':
    auth=line[5:]

root = "http://www.google.com/reader/api/0/"

req = urllib2.Request(root + "token")
req.add_header('Authorization', 'GoogleLogin auth=' + auth)
f = urllib2.urlopen(req)
token = f.readlines()[0]

# get user id
req = urllib2.Request(root + "user-info?output=json&token="+token)
req.add_header('Authorization', 'GoogleLogin auth=' + auth)
f = urllib2.urlopen(req)
dictUser = json.loads(f.read())
user_id = dictUser["userId"]
print "user_id",user_id

req = urllib2.Request(root + "subscription/list?output=json&token="+token)
req.add_header('Authorization', 'GoogleLogin auth=' + auth)
f = urllib2.urlopen(req)

# for line in f.readlines():
#     print line
dictSubscriptions = json.loads(f.read())

# pprint.pprint(dictSubscriptions)
# print the first 3 subscription titles
for i in dictSubscriptions["subscriptions"][0:2]:
    print i["title"]

req = urllib2.Request("http://www.google.com/reader/api/0/unread-count?output=json&token="+token)
req.add_header('Authorization', 'GoogleLogin auth=' + auth)
f = urllib2.urlopen(req)
dictUnread = json.loads(f.read())
# pprint.pprint(dictUnread)
# print the first 3 unread folders
for i in dictUnread["unreadcounts"][0:3]:
    print i["count"], i["id"]

# this returns all starred items as xml
req = urllib2.Request("http://www.google.com/reader/atom/user/"+user_id+"/state/com.google/starred?token="+token)
req.add_header('Authorization', 'GoogleLogin auth=' + auth)
f = urllib2.urlopen(req)
starredItems = f.read()
+2

Google Reader . , . , PubSubHubbub , /... .

, 1 2013 Google Reader . Superfeedr.

0

Source: https://habr.com/ru/post/1772361/


All Articles