Created
April 3, 2019 19:59
-
-
Save gmalysa/a258bb7e2a9856283348427f7d302028 to your computer and use it in GitHub Desktop.
With node-dota2/node-steam, you need an updated list of steam login servers, because the server list that ships with node-steam is like 9 months out of date. Periodically should also rebuild this list.
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
const steam = require('steam'); | |
const steamClient = new steam.SteamClient(); | |
const steamUser = new steam.SteamUser(steamClient); | |
const dota2 = require('dota2'); | |
const dotaClient = new dota2.Dota2Client(steamClient, true); | |
if (fs.existsSync('steam-servers.json')) { | |
steam.servers = JSON.parse(fs.readFileSync('steam-servers.json')); | |
} | |
steamClient.connect(); |
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
[{"host":"155.133.254.132","port":"27017"},{"host":"155.133.254.132","port":"27018"},{"host":"155.133.254.132","port":"27019"},{"host":"155.133.254.133","port":"27019"},{"host":"155.133.254.133","port":"27017"},{"host":"155.133.254.133","port":"27018"},{"host":"162.254.195.47","port":"27017"},{"host":"162.254.195.45","port":"27019"},{"host":"162.254.195.44","port":"27018"},{"host":"162.254.195.44","port":"27019"},{"host":"162.254.195.47","port":"27019"},{"host":"162.254.195.45","port":"27018"},{"host":"162.254.195.46","port":"27017"},{"host":"162.254.195.45","port":"27017"},{"host":"162.254.195.44","port":"27017"},{"host":"162.254.195.46","port":"27018"},{"host":"162.254.195.46","port":"27019"},{"host":"162.254.195.47","port":"27018"},{"host":"162.254.193.47","port":"27018"},{"host":"162.254.193.7","port":"27018"},{"host":"162.254.193.6","port":"27017"},{"host":"162.254.193.6","port":"27019"},{"host":"162.254.193.7","port":"27017"},{"host":"162.254.193.46","port":"27017"},{"host":"162.254.193.6","port":"27018"},{"host":"162.254.193.47","port":"27019"},{"host":"162.254.193.7","port":"27019"},{"host":"162.254.193.46","port":"27019"},{"host":"162.254.193.47","port":"27017"},{"host":"162.254.193.46","port":"27018"},{"host":"205.196.6.67","port":"27018"},{"host":"205.196.6.75","port":"27019"},{"host":"205.196.6.75","port":"27018"},{"host":"162.254.192.101","port":"27019"},{"host":"205.196.6.67","port":"27017"},{"host":"205.196.6.75","port":"27017"},{"host":"205.196.6.67","port":"27019"},{"host":"162.254.192.108","port":"27018"},{"host":"162.254.192.101","port":"27018"},{"host":"162.254.192.101","port":"27017"},{"host":"162.254.192.109","port":"27019"},{"host":"162.254.192.100","port":"27019"},{"host":"162.254.192.108","port":"27017"},{"host":"162.254.192.109","port":"27018"},{"host":"162.254.192.109","port":"27017"},{"host":"162.254.192.100","port":"27018"},{"host":"162.254.192.108","port":"27019"},{"host":"162.254.192.100","port":"27017"},{"host":"162.254.196.68","port":"27019"},{"host":"162.254.196.84","port":"27017"},{"host":"162.254.196.83","port":"27018"},{"host":"162.254.196.67","port":"27017"},{"host":"162.254.196.68","port":"27017"},{"host":"162.254.196.84","port":"27018"},{"host":"162.254.196.68","port":"27018"},{"host":"162.254.196.83","port":"27017"},{"host":"162.254.196.84","port":"27019"},{"host":"162.254.196.67","port":"27019"},{"host":"162.254.196.67","port":"27018"},{"host":"162.254.196.83","port":"27019"},{"host":"185.25.182.77","port":"27018"},{"host":"185.25.182.77","port":"27019"},{"host":"185.25.182.76","port":"27018"},{"host":"185.25.182.77","port":"27017"},{"host":"185.25.182.76","port":"27017"},{"host":"185.25.182.76","port":"27019"},{"host":"155.133.248.52","port":"27019"},{"host":"155.133.248.53","port":"27018"},{"host":"155.133.248.50","port":"27017"},{"host":"155.133.248.50","port":"27019"},{"host":"155.133.248.52","port":"27018"},{"host":"155.133.248.51","port":"27018"},{"host":"155.133.248.53","port":"27019"},{"host":"155.133.248.53","port":"27017"},{"host":"155.133.248.52","port":"27017"},{"host":"155.133.248.50","port":"27018"},{"host":"155.133.248.51","port":"27017"},{"host":"155.133.248.51","port":"27019"},{"host":"162.254.198.130","port":"27018"},{"host":"146.66.152.10","port":"27019"},{"host":"146.66.152.11","port":"27019"},{"host":"155.133.246.68","port":"27019"},{"host":"162.254.197.180","port":"27019"},{"host":"162.254.197.181","port":"27019"},{"host":"162.254.197.180","port":"27017"},{"host":"162.254.198.133","port":"27018"},{"host":"146.66.152.10","port":"27018"},{"host":"155.133.246.69","port":"27019"},{"host":"162.254.197.180","port":"27018"},{"host":"162.254.197.181","port":"27018"},{"host":"162.254.197.42","port":"27017"},{"host":"162.254.197.40","port":"27019"},{"host":"162.254.198.133","port":"27017"},{"host":"162.254.198.130","port":"27019"},{"host":"162.254.198.133","port":"27019"},{"host":"146.66.152.11","port":"27017"},{"host":"146.66.152.11","port":"27018"},{"host":"155.133.246.69","port":"27018"},{"host":"155.133.246.68","port":"27017"},{"host":"155.133.246.68","port":"27018"}] |
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
var request = require('request'); | |
var fs = require('fs'); | |
var process = require('process'); | |
request( | |
'https://api.steampowered.com/ISteamDirectory/GetCMList/v1/?cellid=0', | |
function(err, response, body) { | |
var data = JSON.parse(body); | |
var servers = data.response.serverlist; | |
fs.writeFile('steam-servers.json', JSON.stringify(servers.map(function(s) { | |
var [host, port] = s.split(':'); | |
return {host, port}; | |
})), process.exit); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment