Jump to content

google search with date range

Recommended Posts

I would like to search google, limiting the date range to the past 2 years.


For example: (using g as a keyword)

g iphone apps 


The search should only show results from the past 2 years.



I had this working in alfred V1, but can't find anything under v2.  I'm sure it's my error. ;)




Edited by kevinapple

Share this post

Link to post

One way that you could do it is to have your workflow create the search string and just open the URL. Look at this string:




So, the part before the ? is obvious.


q={input} is the query.

and as_qdr asks for the last results. Here the syntax is pretty obvious #y = number of years, #m = number of months, etc...


So, if you wanted to do what you did above and make it so it's always two years, then you'd grab the {query} and substitute "+" for " ". Then, you'd create the base URL:




And then you'd append the time string: "&as_qdr=2y".


So, then you'd concatenate them to give you:




After that, you would just open the location in whatever browser you want.


If you want to show the results in Alfred, then you'll have to pull in the results in json or xml or something. Here's a really old blog post showing you how to use an API that is deprecated but still seems to work: http://googlesystem.blogspot.com/2008/04/google-search-rest-api.html.


Good luck.

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...