Firefox browsing history polling

From XPUB & Lens-Based wiki
import sqlite3, time, datetime

t = datetime.datetime.today()
mn = datetime.datetime(t.year,t.month, t.day)
ts = time.mktime(mn.timetuple())

ts = long(time.time()*1000000)
print ts

conn = sqlite3.connect('/Users/ARRA/Library/Application Support/Firefox/Profiles/x39c3q8q.default/places.sqlite')
c = conn.cursor()

while True:
	print "checking"
	for row in c.execute('select url, last_visit_date from moz_places WHERE last_visit_date > ? ORDER BY last_visit_date', (ts,)):
		print row
		ts = row[1]

	time.sleep(2)