Skip to content

Instantly share code, notes, and snippets.

@yuanliwei
Created November 20, 2018 16:04
Show Gist options
  • Save yuanliwei/7b40c3e7becde2f477e302c1a9c74ef4 to your computer and use it in GitHub Desktop.
Save yuanliwei/7b40c3e7becde2f477e302c1a9c74ef4 to your computer and use it in GitHub Desktop.
fetchWildDogApps
async function fetchWildDogApps() {
for (var i = 0; i < 100; i++) {
var html = await GET(`https://github.com/search?p=${i+1}&q=.wilddogio.com&type=Code&_pjax=%23js-pjax-container`)
var urls = html.match(/https?:\/\/[^<]{1,50}.<em>wilddogio<\/em>.<em>com<\/em>/g)
if (!urls) { continue }
urls.map((item)=>item.replace(/<[^.]+>/g,''))
window.globalUrls = [...new Set(window.globalUrls.concat(urls))]
console.log(window.globalUrls.length, i);
}
}
async function GET(url) {
return new Promise(function(resolve, reject) {
var request = new XMLHttpRequest()
request.open('GET', url, true)
request.onreadystatechange = () => {
console.log(' - readyState:' + request.readyState + ' status:' + request.status)
if (request.readyState == 4) {
resolve(request.responseText)
}
}
request.onerror = (a,b,c)=>{
console.log(a,b,c);
}
request.send()
});
}
window.globalUrls = []
fetchWildDogApps()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment