Board Thread:Support Requests - Getting Technical/@comment-10688548-20130202074623/@comment-4674838-20130202205159

Unfortunately, accomplishing this task with in browser JavaScript seems it would also be a very tedious. It's not something I'm up for doing at the moment. I think a bot-based approach would be much better. But here's a couple ideas for someone who might want to give it a try:

Idea 1

 * 1) Build up a list of all valid Wikia's from the API. That is, make a series of requests to http://community.wikia.com/api.php?action=query&list=wkdomains&wkfrom=1&wkto=1000 and change the values of wkfrom and wkto until you've cycled through all ~300,000 Wikia wikis.
 * 2) *Problem: building the list would take a long time.
 * 3) Store that list somewhere.
 * 4) Search that list for languagecode.subdomain.wikia.com
 * 5) *Problem: searching the list would be horribly inefficient.

Idea 2

 * 1) Load languagecode.subdomain.wikia.com in the same window the script is running in
 * 2) Detect if a server-side redirect to Community Central:Not a valid Wikia occured.
 * 3) *Problem: in-browser cross-domain requests prohibited by Same Origin Policy
 * 4) Circumvent the same origin policy by making a JSONP request to http://LANGUAGECODE.SUBDOMAIN.wikia.com/api.php?action=query&meta=siteinfo&format=json
 * 5) *Problem: in cases where the wiki doesn't exist, the server-side redirect to Community Central:Not a valid Wikia will cause the request to not return JSON, causing a parse error
 * 6) Ignore the parse error and hope it doesn't crash the script

Note: Idea 2 becomes far, far more practical if done by a bot framework instead of with an in-browser script, as the Same Origin Policy would not apply.