You can maybe use Socket to access web page and parse text with RegExp.
Or, maybe, if script is not required, you can use my little panel extension for InDesign
which enables you browse the web directly from InDesign
and you can drag-and-drop text from web directly to layout.
Panel can be found here: http://bit.ly/aAuXXW
Hope that helps.
Since you mention "Safari", you are likely to work on a Mac.
In fact, what I really need is a way to copy text content from an already opened web page directly into an also already opened Indesign doc, without having to use something like select all and then copy-paste. I have no understanding of what you mention: Socket and RegExp.
The web page that I have opened is always a specific page in an online web application (not always the same content, so different content at every login or step in the online process). Maybe you have an example available in Js?
This is an extension of an existing script.
And this is written in JS.