The TextParser is a module that provide text snippets from websites or files.
Integration into IP-Symcon
The TextParser can be searched and added as instance via the "+" in the Object Tree. Within the configuration of the TextParser, a gateway that provides the raw text can be selected via "Change Gateway". For example, an HTTP Client can be selected.
The TextParser in IP-Symcon allows to cut off certain parts e.g. of a web page or a file by executing several rules consecutively. The following rules are available:
|Cuts off all text before Tag1
|Cuts off all text after Tag1
|Brings all text until Tag1 in the variable
|Get Text Between
|Cuts the text between Tag1 and Tag2 and writes it in the variable
Multiple rules can be applied consecutively and even additional "Get Text" - "Get Text Between" operations can be used.
A small example will show how to read the first headline of heise.de to show it e.g. in the WebFront.
- Create a Text Parser.
- Next, create a parent instance. In this example, a HTTP Client is required.
- In the HTTP Client, the URL heise.de must be entered and eventually the timer activatec, which requests the page cyclically.
- Back in the Text Parser, the HTTP Client needs to be configured as Gateway. It can be selected via "Change Gateway".
- In the Text Parser, the following rules need to be defined to read the title.
These rules can be deducted by looking at the HTML Code that is read by the HTTP Client. In the code, it should be searched for significant parts, that should be cut. This is repeated until the desired text remains. Those rules are the entered into IP-Symcon.
- With "Get Text" a variable is defined where the completely cur text is saved.
|Cut Text Before