pygoogle search restricted by date
Lutz Schroeer
ifls at rz.tu-clausthal.de
Mon Jun 3 08:19:32 EDT 2002
Hi Pythonistas,
The Goolge API doc tells me that I can restrict my search to a specific date
range using "daterange:<date1>-<date2>" where date1 and date2 are Julian Day
Numbers. I put the term in the restrict part auf the doGoogleSearch function
(-> code snippet). Nevertheless I'm getting the same results.
Any hints?
Lutz
<--snip-->
import google
from mx.DateTime import *
google.setLicense('<mykey>')
today = int(now().jdn)
yesterday = today - 1
restrict_query = 'daterange:%d-%d' % (yesterday, today)
data = google.doGoogleSearch('python', restrict = restrict_query)
for x in data.results:
print x.title, x.URL
--
More information about the Python-list
mailing list