Script to search google - problem with multiple quotations
Posted: 30 Jan 2012 22:03
Hello,
I have a fairly simple question to ask but I haven't been able to figure this problem out. I'm working on a script that calls up a browser and performs advanced google searches which have multiple double quotes in them. The way I'm doing this is by using google's search syntax directly in the URL which I send to chrome. The google search is supposed to look something like this:
intitle:"hello there" inurl:"some other term"
At first I tried the following code:
(which works just fine if I copy paste it into the url bar)
This brought up the google search results page, but the quotes got removed and only the first search term made it through, this is what the search ended up looking like:
intext:hello there
Then I tried this code:
The google search result ended up being:
intext:hello there inurl:some other term
So I think I'm halfway there, but the quotes got removed from the search. I had to double the % symbol in the URL to escape it, otherwise there would be no space between the two search terms. But I'm not sure how to make the quotation marks show up in the query, they seem to disappear from the URL when it gets sent to chrome.
I thought I should add that I'm using windows 7 not xp, I don't know if this would make much of a difference.
Any help would be greatly appreciated. Thank you.
I have a fairly simple question to ask but I haven't been able to figure this problem out. I'm working on a script that calls up a browser and performs advanced google searches which have multiple double quotes in them. The way I'm doing this is by using google's search syntax directly in the URL which I send to chrome. The google search is supposed to look something like this:
intitle:"hello there" inurl:"some other term"
At first I tried the following code:
Code: Select all
start chrome.exe http://www.google.com/search?q=intext:"hello there" inurl:"some other term"
This brought up the google search results page, but the quotes got removed and only the first search term made it through, this is what the search ended up looking like:
intext:hello there
Then I tried this code:
Code: Select all
start chrome.exe http://www.google.com/search?q=intext:"hello there"%%20inurl:"some other term"
The google search result ended up being:
intext:hello there inurl:some other term
So I think I'm halfway there, but the quotes got removed from the search. I had to double the % symbol in the URL to escape it, otherwise there would be no space between the two search terms. But I'm not sure how to make the quotation marks show up in the query, they seem to disappear from the URL when it gets sent to chrome.
I thought I should add that I'm using windows 7 not xp, I don't know if this would make much of a difference.
Any help would be greatly appreciated. Thank you.