Trying to connect to webpage and return a list of all the file names listed there.
I wont include the whole code (to generate token etc), but using the below I can return the whole HTML doc.
$r = invoke-RestMethod $url -Headers @{Authorization="Bearer $bearerToken"}
But I want to just get out the names of all the zip files, so in the below example I just want to return : 1_1_!!_DEV_ORG_HIER.zip
<td>
<a href="/xxxxxxx/rest/DEFAULT/20/file/deployments/1_1_!!_DEV_ORG_HIER.zip">1_1_!!_DEV_ORG_HIER.zip</a>
</td>
Tried various things and plenty of googling, but no joy, I'm sure its something simple that is eluding me.
Any help greatly appreciated.
CodePudding user response:
Managed to achieve what I wanted by using
Invoke-WebRequest
rather than Invoke-RestMethod
As below.
$r = (Invoke-WebRequest $url -Headers @{Authorization="Bearer $bearerToken"}).links.innerhtml