Jump to content

Custom Search Parameters After Query not Passed on to Search Engine


paulmoons

Recommended Posts

I, too, have been exploring a Google custom search string to ensure that AI results are excluded. All I can say is that it involved an awful lot of fiddling around before I hit the right combination. I've not added &tbs=li:1 to my search string but as I always want to exclude results from Amazon, eBay and YouTube I needed to add those exclusions. What finally worked for me was:

 

https://google.co.uk/search?q={query}+ -amazon -ebay -youtube &udm=14

 

The spacing appeared to be important. Sorry it's not a more direct answer to your question but I suspect that, with a little experimentation you may succeed in creating what you need. I have my search string working in Alfred, Keyboard Maestro and Firefox. I do not believe there's any inherent problem with Alfred in this context.

 

Stephen

 

 

Link to comment
Share on other sites

7 minutes ago, Stephen_C said:

https://google.co.uk/search?q={query}+ -amazon -ebay -youtube &udm=14

 

 

The spacing appeared to be important. Sorry it's not a more direct answer to your question but I suspect that, with a little experimentation you may succeed in creating what you need. I have my search string working in Alfred, Keyboard Maestro and Firefox. I do not believe there's any inherent problem with Alfred in this context.

 

Thanks but there is an inherent problem with Alfred in this context. The URL you supplied, like my own, simply cannot work in Alfred.

 

I'll say it again, Alfred passes on nothing after the query, hence the bug report.

Link to comment
Share on other sites

4 minutes ago, paulmoons said:

I'll say it again, Alfred passes on nothing after the query, hence the bug report.

Sorry—I do not believe that is correct. I have a custom fallback search set in Alfred using exactly the URL I've given and it works perfectly. The only warning I'd give is that in the UK i believe Google has not yet implemented this infernal nonsense of placing AI results at the top of the search so I can't specifically test that aspect. What I can say is that all the search parameters are properly passed (which I can see from the search URL when making a search).

 

How are you trying to implement the custom search URL? The way I started was to test one using a keyword linked to an Open URL action—which allowed for some debugging of the process.

 

(I should also say that, using Firefox and always using private mode, I don't actually use the Google fallback search I created because I prefer to ensure any Google search opens in a Firefox private window.)

 

Stephen

Link to comment
Share on other sites

Posted (edited)

Hmm.. the plot thickens.

 

I've done some more experimenting and I still think there is a bug, but you're right, your removal tags are working. Here's the really strange part: Without the removal tags (thanks for reminding me to remove pinterest 😃) the &udm=14 tag doesn't seem to be passed along, no matter what combinations of spaces, etc. I try.

 

Very strange.

 

EDIT: Also, I don't think a second call to &tbs=li:1 works using your URL, further highlighting the issue of how Alfred passes on parameters to Google.

Edited by paulmoons
Link to comment
Share on other sites

Posted (edited)

Actually, I don't think your &udm=14 tag works either as the search results are much cleaner when they are run directly from Firefox. Something is not right.

Edited by paulmoons
Link to comment
Share on other sites

Posted (edited)

This is clearly worth more exploration. I'm getting different results with and without the &udm=14 tag. It's quite easy to check, of course. Set up two workflows using different keywords, one using whatever standard Google URL you use and one identical but with the &udm=14 tag and then repeat the same search using both. For what it's worth I seem to get cleaner results with the tag (although given my next point it's difficult to understand why).

 

As I said, it's difficult to test specifically on the AI nonsense as it's not yet inflicted on us here in the UK.

 

Edit: For example, the tag appears to get rid of the annoying "People also ask…” business in the search result.

 

Stephen

Edited by Stephen_C
Link to comment
Share on other sites

Yeah I agree. I've been messing about with this for the past hour and the results are very inconsistent. The best results I get are from my custom search engine directly from Firefox which produces completely clean results but I can't seem to get Alfred to do the same no matter what.

 

https://www.google.com/search?q=%s&udm=14&tbs=li:1

 

Ironically, as soon as I add any sort of negative keyword tag, it works inconsistently. Note the %s replaces Alfred's {query} for those playing at home.

 

@Stephen_C Thanks for your help and exploration!

 

 

Link to comment
Share on other sites

On 5/26/2024 at 5:20 AM, paulmoons said:

I am trying to implement the following custom search URL

 

What method are you using? Is it a Web Search, an Open URL, or something else? Please share your result (export the Workflow or copy the Web Search URL) so we can properly investigate.

 

Additionally, what are the exact versions of Alfred and macOS you are on?

 

We need all the information we can get, as I’m unable to reproduce your issue. The Web Search I used was: alfred://customsearch/Clean%20Google/g/utf8/nospace/https://www.google.com/search?q=%7Bquery%7D&udm=14&tbs=li:1 (copy and paste that into Alfred).

 

On 5/26/2024 at 5:20 AM, paulmoons said:

Alfred refuses to pass on any code after the query

 

As stated, I’m unable to reproduce. But if that were the case you could switch the parameters around, the order doesn’t matter: https://www.google.com/search?udm=14&tbs=li:1&q={query}

 

On 5/26/2024 at 6:16 AM, paulmoons said:

how Alfred passes on parameters to Google.

 

Alfred doesn’t pass parameters to Google. Alfred doesn’t care what’s in your URL and won’t modify it apart from escaping characters. It simply grabs what it’s there and then tells macOS to open it (and it’s then macOS who asks the default browser to open that URL). If you’re not seeing the parameters in the URL of the opened tag, it could be Google redirecting you or a browser extension modifying it.

Link to comment
Share on other sites

Posted (edited)

Ugh. Firstly, thanks for your help @Stephen_C and @vitor. I wrote an entire explanation answering all your questions.. and even included screenshots but as I was thinking it through, I managed to solve the problem! And Alfred was not the culprit!

 

I was right that parameters weren't being passed on, but it wasn't Alfred.. or my browser. In between these two, I use a tiny app called Velja to automagically select the right browser based on certain parameters. For the record, it's great and you should check it out if you don't know about it! Anyway, there's a setting in Velja that blocks "tracking parameters when opening links." This was stripping the &class, etc. from Alfred's URL!

 

I have reached out to the maker of Velja and reported it as a bug.

 

Thanks again for taking the time folks and sorry for wasting your time. 🫠

Edited by paulmoons
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...