Jump to content

Google Custom Search in Alfred?


Recommended Posts

Hello everyone,

 

I ofter have to browse several sites for video tutorials, so I go on each of them, type the tutorial I am looking for and see what they have. Then I go to the next site and repeat the process. It works, but I started wondering if I could search all sites at once.

First I thought I could do it in Alfred, but because most of these sites search is more of a browse thing, I can't get the {query} string that is needed to do that. Here's one of them so you know what I mean https://www.macprovideo.com/

Maybe you can go around this somehow, but I couldn't figure it out.

So I searched Google for a solution, and found Custom Google Search Engines. I didn't even knew it existed, but it does. So you can create a personalized Google search engine that only looks into the sites you want. Pretty cool.

Here's the one I just created https://cse.google.com/cse/publicurl?cx=016685344683901672096:56dgrtoymes

 

Now, with this is mind, would it be possible to use the personalized Google search from Alfred?

 

Thank you all so much for the time,

Rui

Link to comment

Here you go. Copy and paste this into Alfred or Safari: 

alfred://customsearch/Search%20Tutorials%20for%20%27%7Bquery%7D%27/tut/utf8/%2B/https%3A%2F%2Fcse.google.com%2F%3Fcx%3D013315504628135767172%253Ad6shbtxu-uo%26cof%3DFORID%253A10%26ie%3DUTF-8%26q%3D%7Bquery%7D

 
I've set the keyword to "tut". Go into Alfred Preferences > Features > Web Search to change it.

Link to comment

Hi deanishe,

 

First of all, thank ou for your help.

 

Unfortunately I don't think it's working as expected. You see, when I use the personalized Google search that I mentioned in my previous post, I get results from the websites I picked only, whereas in your Alfred search, I seem to be getting no results, or results from Google search help.

Let me use an example. One of my favorite Sampler instrument plugins is Native Instruments Kontakt. I need tutorials to learn Kontakt, so I go to my personalized Google Search, type Kontakt, and I get results matching Kontakt in only the websites I chose for my personalized Google Search. When I do the same using your search in Alfred, this is what I get https://cse.google.com/?cx=013315504628135767172%3Ad6shbtxu-uo&cof=FORID%3A10&ie=UTF-8&q=kontakt#gsc.tab=0&gsc.q=kontakt&gsc.page=1

Not what I wanted :(

 

Maybe I wasn't able to explain what I need. Sorry if that was the case. And thank you again for taking the time.

Link to comment

Hello there once again,

 

Since this worked so well, I have a couple more custom searches I would like to create. Could you guys share the process of creating the link I need for a new Alfred custom web search? I mean, from the public link I get from creating a custom Google Search, how to I get to the link you shared with me?

 

Thank you so much!

Link to comment

Hi,

well, what I did to find the correct link was analyze the google web page using chrome browser.

I have seen that, after typing the search term and hit the button, the page opens a container with inside an iframe.

don't know if you are familiar with html,an iframe is an element of a web page containing another webpage, and looking at the iframe address we have found ( I imagine deanishe did more or less the same thing ) the correct link.

 

BUT, since we have already discover the correct link, I think there's now a simpler way:

 

look at the original custom search address ( I'm removing the https:// part):

 

cse.google.com/cse/publicurl?cx=016685344683901672096:56dgrtoymes

 

we have transformed it in:

 

cse.google.com/cse?r=m&cx=016685344683901672096:56dgrtoymes&q={query}

 

in a link as you know the parameters are name/value couples following the ? symbol, and separated by the & symbol.

 

so we can guess that cx=016685344683901672096:56dgrtoymes is the code assigned by Google at your custom search, a parameter named cx with a value of 016685344683901672096:56dgrtoymes

 
and I'm hopeful that you can look at the link of your new custom search, copy the value following cx= , and simply paste it on new link...
 
example:
 
cse.google.com/cse/publicurl?cx=111222333aaabbbccc
 
will result in:
 
cse.google.com/cse?r=m&cx=111222333aaabbbccc&q={query}

 

hope this helps,

 

     Giulio

Edited by juliosecco
Link to comment

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...