Last active
March 10, 2022 03:34
-
-
Save supphawit/48e3751022f3d3331c95aac57e2854cf to your computer and use it in GitHub Desktop.
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
const https = require("https"); | |
let argv = process.argv[2]; | |
let options = { | |
hostname: "codequiz.azurewebsites.net", | |
path: "/", | |
method: "GET", | |
headers: { Cookie: "hasCookie=true" }, | |
}; | |
let answer; | |
let req = https.request(options, function (res) { | |
let body = ""; | |
res.on("data", function (chunk) { | |
body = body + chunk; | |
}); | |
res.on("end", function () { | |
let table = "<table>" + body.split(/<table>|<\/table>/)[1] + "</table>"; | |
let filter = table.split(/<td>|<\/td>/).map((e) => e.trim()); | |
let find = filter.indexOf(argv); | |
let ans = filter.splice(find, 8).filter((e) => e); | |
answer = ans[1]; | |
console.log(answer); | |
}); | |
}); | |
req.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment