Ho una stringa racchiusa tra i tag <h1></h1> del tipo <h1>testo/h1> dentro una pagina web (online)
Vorrei estrarre tale stringa, presente dentro il tag html di una pagina web (www..) o da una lista di indirizzi web ed esportarne il contenuto in un file di testo .txt al cui interno posso trovare

codice:
testo1
testo2
testo3

Il codice per lo script di Poweshell che sto provando a testare è questo

codice:

codice:
#extract utils data and clean 
$listbook=gci $rootpath -File | foreach { New-Object psobject -Property @{file=$_.fullname; books= ((iwr "https://www.link.zz/page/2/","https://www.link.zz/page/3/").ParsedHtml.body.outerText


#extract tag
$myarray = gc $newpath | 
% { [regex]::matches( $_ , '(?<=<h1>\s+)(.*?)(?=\s+</h1>)' ) } | 
select -expa value


#build file text
$listbook | %{$newpath="$rootpathresult\$($_.subject)"; New-Item -Path . -Name "testfile1.txt" -ItemType "file" ;



Ho provato a dare una letta qui
https://stackoverflow.com/questions/...contained-tags

ma ho difficoltà a tradurlo in un codice corretto, infatti il mio codice powershell non funziona.