
https://forum.lazarus.freepascal.org/index.php/topic,54770.msg407099.html#msg407099

You can also solve this without using third-party software: Use unit fasthtmlparser which comes with FPC; it iterates through the html text character by character and fires an event OnFoundTag whenever a tag is seen and returns the text between the '<' and the '>'. And it fires an event OnFoundText whenever it sees a text node and returns the text between then '>' of the previous tag and the '<' of the following tag. Studying the nodes of the input text and introducing some state variables it is relatively straightforward to extract the desired information. Check out the attached demo. Note that you must make sure that the SSL libraries can be found - in Windows you normally must copy the libeay32.dll and ssleay32.dll into the exe folder. Note also that I did not manage to download from the given site using the fphttpclient which comes with FPC, and that I had to use synapse instead - so make sure that the synapse package is available.

