const axios = require('axios');
const cheerio = require('cheerio');
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
const util = require('util');
const question = util.promisify(readline.question).bind(readline);
const getHTML = async (url) => {
const { data } = await axios.get(url)
return cheerio.load(data)
}
async function questionExample() {
const userIdInput = await question('Введите ID пользователя: ');
for (let i = 0n; i <= 0n; ++i) {
let userID = BigInt(userIdInput) + i;
const $ = await getHTML('https://steamcommunity.com/profiles/' + String(userID));
//LVL
let userLvl = $('span.friendPlayerLevelNum').eq(0).text();
if ((Number(userLvl) === 0)) {
userLvl = true;
} else {
userLvl = false;
}
//ONLINE
let userOnline = $('div.profile_in_game_header').eq(0).text();
if ((String(userOnline) === 'Currently Online')) {
userOnline = true;
} else if ((String(userOnline) === 'Currently In-Game')) {
userOnline = true;
} else if ((String(userOnline) === 'In non-Steam game')) {
userOnline = true;
} else {
userOnline = false;
}
}
}
questionExample();