I have a file "C:\temp\Leather Sofas\$line.txt" I need to retrieve a specific string from this file "https://d9zprmkgswf02.cloudfront.net/m/12b5900a217677ec/SwatchRangeMediumLandscape-SWATCH_AMX01_BAXTER2_NEW-ENDURANCE-MUSHROOM-D-BROWN-CTRST.jpg"
How would I go about this? I currently have
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"
Where can I go from here?