Created
November 20, 2018 16:04
-
-
Save yuanliwei/7b40c3e7becde2f477e302c1a9c74ef4 to your computer and use it in GitHub Desktop.
fetchWildDogApps
This file contains hidden or 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
| 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