Parsing HTML in Thunkable ✕ Cross Platform

Hello!
Help me please, is it possible to parse HTML pages in Thunkable ✕ Cross Platform?

I need to get some text from the HTML page that contains:
{«status»: 200, «data»: «486F6D6553616D6F676F6C312C3737372E302C3737372E302C302C»}

I know that the text starts at «status»: 200, «data»: « and ends at 302C»}, can I get this part of the text:
486F6D6553616D6F676F6C312C3737372E302C3737372E302C302C ?

Thanks in advance!

1 Like

Hello!

1 Like

Hi, @STX-121!
Will the HTML always be the same?
If yes, I will suggest this :

Hope it helps! :wink:

Thank Actech!
But you misunderstood me
Only the anchors of the beginning and end of the text are known, the text itself is unknown (and it should be parsed)

This is absolutely the solution :smile: :+1::+1:

I just gave an easy way…

Okay.
From where will you get the HTML?

Yes, please show the line that you know. Otherwise, it is difficult for us to understand what you want to do.

1 Like

Hi Kartik,

Instead of literal 26, I would use a block to determine the length of a string.

1 Like

Hmmm…
You are also right!

Thanks!

Can you program in JavaScript?

No… :sweat_smile:
I know only medium level C++ and a very little php…

This is also good!

I say this to the fact that the knowledge of JavaScript helps a lot when programming on Thunkable X. Try it, you may like this language.

2 Likes

Thanks for the Suggestion!
how can JavaScript help me here?

While in Thunakble X there is no possibility of data exchange between WebViewer and App, but you can use JavaScript to work with WebViewer and create hybrid applications.

In my project, for example, JavaScript is used on the screens:

scrSystemInfo
scrFileViewer
scrChart
scrHtml

https://x.thunkable.com/projects/5cd84f23e3097f3353fdad45/project/properties/designer/

1 Like

Thank you so much! I will definitely try it!

As you know, Thunkable X is built on React Native core, and React Native is used by JavaScript.

It may seem too loud words, but JavaScript has just a huge scope.

1 Like

Data is taken from a page similar to this: https://samogon.pro/uart.htm
The content and length of the text change every 5 seconds
Only the beginning {“status”: 200, “data”: " and the end 302C"} aways unchanged.

1 Like

Perfectly. Is my example not working for you?

The content and length of the text change every 5 seconds

I did not see it

1 Like

An example, unfortunately, returns “Undefined”, probably because the source text is not JSON

Page https://samogon.pro/uart.htm is simply a sample.
The original is formed on the ESP8266 and is used to control the Arduino from the smartphone.

I solved the problem by simply replacing the text, this is not at all elegant and does not work on dynamic content, but in my case it works :slight_smile:

It would be great to add the ability to search for a piece of text by starting/ending values.
For parsing custom formats, that would be perfect!

1 Like