Created
April 8, 2015 03:13
-
-
Save json-m/93abd0924876f2111b4e to your computer and use it in GitHub Desktop.
eveeye.com static connection scraper
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
#!/bin/env node | |
// eveeye static connection scraper | |
// npm install underscore string request limiter | |
var _ = require('underscore') | |
fs = require('fs') | |
str = require('string') | |
request = require('request') | |
RateLimiter = require('limiter').RateLimiter | |
limiter = new RateLimiter(3, 'second') // lets be "reasonable" | |
url = "https://eveeye.com/solarsection.asp?system=" | |
readArray = fs.readFileSync('wormholes.txt').toString().split('\n') // newline seperated list in wormholes.txt | |
whArray = readArray.filter(function(A){return A!==''}) | |
function getStatic() { | |
var system = arguments[0] | |
request(url+system, function(e, r, b) { | |
var d = str(b).decodeHTMLEntities().s | |
i = str(d).stripTags().s | |
c = /via..(\b\w{4}\b)/g | |
k = i.match(c) | |
s = /(\b\w{4})/g // way too lazy | |
lol = JSON.stringify(k).match(s) | |
staticArray = _.toArray(lol) | |
_.each(staticArray, function(u, index) { | |
if (u=="null") { // probably not the best thing to return when related to eve | |
console.log(system, 'UNKNOWN') // somehow better | |
} else { | |
console.log(system, u) | |
} | |
}) | |
}) | |
} | |
_.each(whArray, function(whatever, index) { | |
limiter.removeTokens(1, function() { | |
getStatic(whatever) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
eveeye.com no longer provides this service and thus this script is now defunct.