Scott Goldman Posted May 30, 2021 Share Posted May 30, 2021 My preferred way to search Google is to limit results to the past year. To do so I use this URL: https://www.google.com/webhp?cr=&tbs=,qdr:y I have attempt to enter that in the "Search URL:" field in Alfred's Preferences so that I could search within Google using that time limit just as I do on a new web tab. However Alfred's response when I click the "Lookup" function is an invalid search. The URL in the dialog box is cut off after the "/webhp" just at the question mark. I have attached a screenshot as illustration. Can anyone provide guidance as to how to use this specific Google search URL as a Custom Search? The intent is so that when I enter a term into Alfred's search field this Custom Search URL would appear as the default search. Then when I hit Return it would enter the searched term in Google's search field and activate the search just as it does for the standard Google URL. Thanks in advance for any guidance you can offer. Link to comment
giovanni Posted May 30, 2021 Share Posted May 30, 2021 you are missing the query field, and I think you have an extra comma. this should work: https://www.google.com/search?q={query}&tbs=qdr:y Link to comment
deanishe Posted May 30, 2021 Share Posted May 30, 2021 6 minutes ago, Scott Goldman said: Can anyone provide guidance as to how to use this specific Google search URL as a Custom Search? You need a URL that has a place for the search query in it. The way a Custom Search works is that you give Alfred a template URL that it can insert your search query into. Then when you action it in Alfred, Alfred inserts the search query and then passes the URL to your browser. https://www.google.com/webhp?cr=&tbs=,qdr:y won't work because there's no place for the search query. As far as I can tell, the proper URL is https://www.google.com/search?tbs=qdr:y&q={query} 12 minutes ago, Scott Goldman said: However Alfred's response when I click the "Lookup" function is an invalid search. It says right there: Not Found. The site doesn't support search URL lookup. There's nothing Alfred can do about that. The Lookup button won’t work in 95% of cases because very few websites support it. It’s basically up to you to figure out the URL that takes you to a website’s search results and where to insert {query} in it. Link to comment
Scott Goldman Posted May 30, 2021 Author Share Posted May 30, 2021 Thanks for trying but https://www.google.com/search?q={query}&tbs=qdr:y definitely does not work. Link to comment
Scott Goldman Posted May 30, 2021 Author Share Posted May 30, 2021 5 minutes ago, deanishe said: You need a URL that has a place for the search query in it. The way a Custom Search works is that you give Alfred a template URL that it can insert your search query into. Then when you action it in Alfred, Alfred inserts the search query and then passes the URL to your browser. https://www.google.com/webhp?cr=&tbs=,qdr:y won't work because there's no place for the search query. As far as I can tell, the proper URL is https://www.google.com/search?tbs=qdr:y&q={query} It says right there: Not Found. The site doesn't support search URL lookup. There's nothing Alfred can do about that. The Lookup button won’t work in 95% of cases because very few websites support it. It’s basically up to you to figure out the URL that takes you to a website’s search results and where to insert {query} in it. I appreciate your reply (although I could have done without the "It says right there" - I can read what it says... which is why I'm asking for assistance or a workaround). That said, I've attempted to "figure out the URL" as you put it. I have attempted to do that and have been unable to which, again, is why I sought help from the forum. Link to comment
deanishe Posted May 30, 2021 Share Posted May 30, 2021 (edited) 14 minutes ago, Scott Goldman said: That said, I've attempted to "figure out the URL" as you put it. Giovanni and I both gave you the correct URL. You're doing something wrong with it, or perhaps expecting it to work differently to the way it does? Try pasting the following into Alfred and hitting ↩. It should give you the search correctly configured (with keyword "recent"): alfred://customsearch/Search%20for%20%E2%80%9C%7Bquery%7D%E2%80%9D%20in%20last%20year/recent/utf8/nospace/https%3A%2F%2Fwww.google.com%2Fsearch%3Ftbs%3Dqdr%3Ay%26q%3D%7Bquery%7D Let us know if that works, and if the setup in Alfred makes sense. Edited May 30, 2021 by deanishe Link to comment
Scott Goldman Posted May 30, 2021 Author Share Posted May 30, 2021 (edited) 1 hour ago, deanishe said: Giovanni and I both gave you the correct URL. You're doing something wrong with it, or perhaps expecting it to work differently to the way it does? Try pasting the following into Alfred and hitting ↩. It should give you the search correctly configured (with keyword "recent"): alfred://customsearch/Search%20for%20%E2%80%9C%7Bquery%7D%E2%80%9D%20in%20last%20year/recent/utf8/nospace/https%3A%2F%2Fwww.google.com%2Fsearch%3Ftbs%3Dqdr%3Ay%26q%3D%7Bquery%7D Let us know if that works, and if the setup in Alfred makes sense. Thanks very much for your follow-up. Yes, pasting that string into Alfred yielded a dialog box as described (see attached screenshot). It also created an entry in the custom search fields for "recent" after I clicked the "Oh, Yes!" button. So far so good and thanks for that clear guidance. What I am trying to do is to replace the standard Google search that appears when invoking Alfred and entering a search term (as shown in the attached screenshot with "ethernet over power lines" search entry). My preference is to have the standard Alfred Google search replaced with the new "recent" custom search just created. In other words, I don't want to have to type "recent" followed by the search term every time I do a search. Sometimes I see what I want in a file on my local drive and other times when I don't I want to hit the Return key to have it search Google. But when I hit the return key I want it to search using the "recent" custom URL instead of the standard Google search. In essence, I want to change the default search. Can that be done? Many thanks. Edited May 30, 2021 by Scott Goldman Link to comment
deanishe Posted May 30, 2021 Share Posted May 30, 2021 (edited) 51 minutes ago, Scott Goldman said: In essence, I want to change the default search. Can that be done? Many thanks. Those are what Alfred calls "fallbacks". Now you’ve created the search you want, go into Alfred Preferences > Features > Default Results > Setup fallback results (searching for ?fallback in Alfred should take you straight there). Add your new custom search to the list with the + button, then drag it to the top of the list. Edited May 30, 2021 by deanishe Link to comment
Scott Goldman Posted May 30, 2021 Author Share Posted May 30, 2021 Bravo! Thanks SO much for your specific guidance on this. It works EXACTLY as I wanted (see new screenshot). It was the one thing missing from Alfred that I had found so frustrating. Many thanks to you (and @Giovanni) for your patient assistance. Link to comment
deanishe Posted May 30, 2021 Share Posted May 30, 2021 If you want to assign a custom icon, you can just drag one from your browser to the image well: Link to comment
Scott Goldman Posted May 30, 2021 Author Share Posted May 30, 2021 Cool idea. Thanks. Link to comment
Scott Goldman Posted June 1, 2021 Author Share Posted June 1, 2021 On 5/30/2021 at 11:29 AM, deanishe said: If you want to assign a custom icon, you can just drag one from your browser to the image well: Thanks for the tip. Did that - results attached. Life is good. 😁 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now