Created
January 18, 2012 23:13
-
-
Save rlemon/1636429 to your computer and use it in GitHub Desktop.
get all SE sites using the public API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildURL(page) { | |
return "http://api.stackexchange.com/2.0/sites?page=" + page + "&pagesize=100&filter=!LQukQ-uVfJGchnRIp_f0_O&callback=run"; | |
} | |
function jsonp(url) { | |
var script_tag = document.createElement('script'); | |
script_tag.src = url; | |
document.documentElement.appendChild(script_tag); | |
} | |
function run(json) { | |
se_site_list = se_site_list.concat(json.items); | |
if( json.has_more ) { | |
jsonp( buildURL(json.page+1) ); | |
} | |
} | |
var se_site_list = []; | |
jsonp( buildURL(1) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment