Hey there!
I am currently trying to create my first widget. As a first test I would like to display the server load of a computer game. I get the data from the page www.newworldstatus.com. However, the corresponding data is only loaded when the page is visited, so I already found out that I have to use Webview.
That’s my initial approach, based on my research so far:
let url = "https://www.newworldstatus.com/";
async function loadSite() {
let wbv = new WebView()
await wbv.loadURL(url)
let jsc = `
var server = document
.getElementsByTagName("tbody")[1]
.getElementsByTagName("td")[106]
.innerText
`
await wbv.evaluateJavaScript(jsc)
console.log(server)
}
The goal is to output the queue from the server Ravenal.
Unfortunately, I’m not getting anywhere… The problem is, among other things, that I only want to evaluate the data from a specific server (Ravenal). My idea was to query the elements (using for loop) until this one is equal to “Ravenal”. But how does this work? Or is there another way?
Thank you very much!