Each answer or comment on a StackOverflow question thread has a unique URL. How can we use that URL with Invoke-WebRequest
(or other tool) to capture just the contents of that answer or comment in mini-Markdown, and from that, some useful information?
Some answers contain complete scripts that I would soemtimes like to automate the retrieval of into .ps1
files on various systems. For example, given this URL https://superuser.com/questions/176624/linux-top-command-for-windows-powershell/1426271#1426271 , I would like to grab just the PowerShell code portion and pipe that into a file called mytop.ps1
.
` elements.
– mklement0 Nov 10 '22 at 23:18