Jump to content

kevinapple

Member
  • Posts

    1
  • Joined

  • Last visited

Reputation Activity

  1. Like
    kevinapple reacted to rice.shawn in google search with date range   
    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:
     
    https://www.google.com/search?q=my+workflow+search&as_qdr=1y3m
     
    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:
     
    http://www.google.com/search?q={parsed_query}
     
    And then you'd append the time string: "&as_qdr=2y".
     
    So, then you'd concatenate them to give you:
     
    http://www.google.com/search?q={parsed_query}&as_qdr=2y
     
    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.
×
×
  • Create New...