I'd like to use mc as a search shortcut for metacritic.com from Google Chrome. I set up the following search URL for the shortcut:
http://metacritic.com/search/all/%s/results
Unfortunately, when I search for patrician iii as follows
mc patrcian iii
Chrome produces this query, which metacritic misinterprets to produce a useless set of unrelated results:
http://www.metacritic.com/search/all/patrician%20iii/results
Metacritic likes this query, giving me exactly the result I was looking for:
http://www.metacritic.com/search/all/patrician+iii/results
How can I force Chrome to use plus symbols instead of URL encoded spaces?
Answer
Though a bit crude, you can create a simple Chrome extensions that adjusts the URL for metacritic (or other sites if you want)
Here's the code I've used for a Metacritic Search URL Replace extension:
manifest.json:
{
"content_scripts": [ {
"include_globs": [ "http://www.metacritic.com/search/*%20*" ],
"js": [ "script.js" ],
"matches": [ "http://*/*", "https://*/*" ],
"run_at": "document_start"
} ],
"converted_from_user_script": true,
"description": "Replaces '%20' in metacritic search request to '+'",
"name": "Metacritic search replacer",
"version": "0.1"
}
script.js:
window.location = window.location.href.replace(/%20/g, "+");
Since I don't really have a reliable spot to upload my extension, here are the instructions to create a Chrome extension using these two files:
First, put the two files in a folder somehwere and browse to chrome://extensions. Make sure the developer mode is active (look at the top right of the page to enable this). Here you can select 'Pack extension..' which asks you for the folder where your script resides. Once you have selected this folder, the extension will be created and you can just drag & drop it into Chrome to install. If everything went according to plan, the script will rewrite the URL for a Metacritic search request from the '%20' to the '+' characters.
Now, you can use http://metacritic.com/search/all/%s/results
as a search engine url in Chrome itself to use a shortcut to this search.
Hope this helps.. ;)
Comments
Post a Comment