Wednesday, August 20, 2008

"Hacking" Blogger's Profile Search

Suppose you want to find all Blogger users that live in Vatican.

You could try a Google Search for the terms "Vatican" and "Blogger." Those results would include any webpage that contained those two terms in it (regardless of whether the author lives in Vatican or is just writing about Vatican or Vatican City), but you could poke around until you got lucky and found a Blogger who actually lived in Vatican. From there, you could read their profile and use their location link to find all the other bloggers who identify themselves as living within Vatican. It might take a while, but you could do it.

Or, you could analyze Blogger's Profile Search URL and figure out it's being used to pass search parameters. Once you understand the logic behind the URL, you could then quickly build your own custom URLs to find Bloggers in Vatican or any country you desire.

The first and most important lesson in "hacking" (in the old-school sense of the word, not in the "breaking into systems/stealing/vandalizing" sense that the media likes to perpetuate these days) is to be observant and figure out the underlying nature of how things work.

Take the typical Profile Search URL from Blogger, for example. When I click on my profile, and then click on the "United States" link by the "Location:" text label, I see the following URL:

http://www.blogger.com/profile-find.g?t=l&loc0=US

See that last part of the URL, the &loc0=US part? That part of the address is being used to tell Blogger which country it should use in its search. If we could deduce the correct country code for Vatican, we can change the URL to get the desired results.

Fortunately, deducing the correct country codes is pretty easy. You just log in to your Blogger account, edit your own profile, and find the drop down list of countries under the "Location:" section. Using View Source in your web browser, find the list of countries. It should look something like this:

<select name="widget.country" id="widget.country" tabindex="0">
<option value="_nil_">Not Specified</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
. . .
<option value="VA">Vatican</option>
. . .
</select>

Obviously, I didn't list all the countries in the drop down list. I also bolded the specific entry we're interested in, so we now know that the country code for Vatican is "VA." That means if we switch the country codes on that previous search URL, we should wind up with:

http://www.blogger.com/profile-find.g?t=l&loc0=VA

The above URL will give us a page with all the Bloggers in Vatican. Don't take my word for it, though. I could be wrong, or something may have changed since I wrote this entry. If you click on the above link and get a list of profiles that all have locations in Vatican, then you know it (still) works properly. Now that you know the "trick" (i.e. find the correct country code, insert it into the URL), you can build your own "custom" links, save them as bookmarks, etc.

Of course, if you really want to be slick about it, you could build your own search form web page with a drop down list of all the countries and their corresponding country codes. (Look for that topic in an entry next week.)

No comments: