Html 如何从文件中提取

Html 如何从文件中提取,html,powershell,extract,Html,Powershell,Extract,我有一个文件“C:\temp\Leather Sofas\$line.txt”我需要从这个文件中检索一个特定的字符串 我该怎么办?我现在有 foreach ($line in Get-Content C:\temp\Results.txt) { try { Invoke-WebRequest "https://www.scs.co.uk/la-z-boy-temptation-3-seater-power-recliner-sofa/$line.html" |

我有一个文件“C:\temp\Leather Sofas\$line.txt”我需要从这个文件中检索一个特定的字符串

我该怎么办?我现在有

foreach ($line in Get-Content C:\temp\Results.txt) {
    try {
        Invoke-WebRequest "https://www.scs.co.uk/la-z-boy-temptation-3-seater-power-recliner-sofa/$line.html" |
            Set-Content "C:\temp\Leather Sofas\$line.txt"
    } catch {
        $_.Exception.Response.StatusCode.Value__
    }

    $A = Select-String -Path "C:\temp\Leather Sofas\$line.txt" -Pattern 'ul class="product-select__list' -Context 1, 1 |
         Set-Content "C:\temp\Leather Sofas\$line list.txt"
    $B = Select-String -Path "C:\temp\Leather Sofas\$line.txt" -Pattern 'class="product-select__item' -Context 0, 0 |
         Set-Content "C:\temp\Leather Sofas\$line item.txt"
    $C = Select-String -Path "C:\temp\Leather Sofas\$line.txt" -Pattern 'class="product-select__link' -Context 0, 0 |
         Set-Content "C:\temp\Leather Sofas\$line Link.txt"
    $D = Select-String -Path "C:\temp\Leather Sofas\$line.txt" -Pattern 'product-select__img' -Context 0, 0 |
         Set-Content "C:\temp\Leather Sofas\$line Image.txt"      

我能从这里走到哪里?

什么具体的线索?没有人告诉过你这是通往黑暗面的道路吗?返回的响应对象应该已经为您提供了解析后的HTML内容(通过一个名为
ParsedHtml
的属性,这可能会让人惊讶)。从那里开始。