Read specific data from HTML

Godot Version

4.4 dev 5

Question

I’m trying to read HTML code from a website through gdscript.
The website https://reactive.fugi.tech is a website that detects who is speaking in a given discord call, and I noticed when using inspect element on the avatars that when I speak, a certain value is set to “true”. You can look at it yourself if you want.
I just want to be able to read this value and do something when it is true. Is there any way to achieve this in godot?

I should add that I’ve been trying for the past three hours via http request and even tried reading the colour of the avatar using a WebView plugin but I couldn’t get it to be an image instead of a texture so that wouldn’t work.

You might be able to XML parse your way through raw HTML, or more likely this website is using javascript that modifies the HTML in a browser, which does not apply to getting a HTTP request once in Godot. If this service has a JSON API, or discord through directly, you will have much better luck, though again these API requests happen once, so you will need to continously check or find a way to use webhooks in Godot.

I see. The idea with the WebView thing didn’t work, I think because it was a Texture2DRD instead of a Texture2D. If there is any way to turn it into a Texture2D so that I can use get_image or something of like to get the colour of a certain pixel, that may work instead,

I dont understand the question… maybe this helps


extends Node

var http_request = HTTPRequest.new()

func _ready():
	add_child(http_request)
	# New syntax for Godot 4.x
	http_request.request_completed.connect(_on_request_completed)
	
	# Make the request
	http_request.request("https://reactive.fugi.tech")

func _on_request_completed(result, response_code, headers, body):
	var html = body.get_string_from_utf8()
	print(html)
	# Parse the HTML here