I am trying to retrieve posts from an IBM Connections forum topic on the intranet. Here’s where I’ve gotten so far, from an examination of the page with F12 in the browser:
The div classes above have a grandfather class which pairs the authors and corresponding posts. My objective is to export the (long) list of authors and corresponding posts to a file. What is the best approach to get a paired array of these values for this purpose?
I don’t know what the page’s code looks like, but using ‘getElementById’ method could be faster. Look for ‘id’ near div classes in your ‘DOM Explorer’ (Example: div class=“text” id=“text”). If an ‘id’ is available, you should be able to find innertext then parse it without the use of foreach-object.
# Example
$test = $WebResponse.ParsedHtml.getElementById('hentry lotusPost').innertext
Did look for that - no IDs to be found. At any rate, I have a handle on the data that I need.
I have on hand two ordered arrays - one of authors and the other of the corresponding posts. My question was more about putting these together into an accessible table or two-dimensional array.
Only thing left is to figure out how to improve the Regex, to correctly fetch the distribution list names embedded in the various posts, but that’s a task for another day.