Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Google +1 feed generator
# -*- coding: utf-8 -*-
Google Plus has no feeds for my +1 and I want to share them in my blog.
This is an incredible simple scrapper to hack that stupidly wrong policy.
My contents are mine!
author: Martín Gaitán <>
How to use?
set your GOOGLE_ID and run it. you'll get a plusone.xml file
Dependencies: pyquery and PyRSS2Gen (both are pip-installables)
import datetime
from pyquery import PyQuery
import PyRSS2Gen
GOOGLE_ID = '102449284377784435533'
def _(text):
"""latin1 to utf8 transcode helper"""
return text.encode('latin1').decode('utf8')
except UnicodeError:
return text
class PlusOne2Rss(object):
def __init__(self, google_id):
self.url = '' % google_id
self.pq = PyQuery(url=self.url)
self.user_name = self.pq('a.a-n[href="%s"]' % google_id).text()
def _title(self, table):
return _(self.pq('div.zCa a.QC', table).text())
def _link(self, table):
return _(self.pq('div.zCa a.QC', table).attr('href'))
def _description(self, table):
return _(self.pq('div.zCa p.GCa', table).text())
def _image_url(pq, table):
return _(self.pq('div.BT a', table).attr('title'))
def write_feed(self, filename='plusone.xml'):
rss_items = []
tables = self.pq('table.KX')
for table in tables:
item = PyRSS2Gen.RSSItem(
title = self._title(table),
link = self._link(table),
description = self._description(table),
guid = PyRSS2Gen.Guid(self._link(table)),
pubDate =
rss = PyRSS2Gen.RSS2(
title = _("%s's +1s" % self.user_name),
link = self.url,
generator= u'plusone2rss',
description = _("The latest %s's +1s" % self.user_name.split(' ')[0]),
lastBuildDate = datetime.datetime.utcnow(),
items = rss_items
rss.write_xml(open(filename, "w"), encoding='utf-8')
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.