Forum Discussion
YeuHarng
Sep 04, 2023Brass Contributor
Download Specific Files From Link
https://www.fbi.gov/wanted/topten/alejandro-castillo/download.pdf Hi here is the link i need to download the file , between the /topten and /download.pdf is the person name. And the website will ...
- Sep 04, 2023
Harm_Veenstra
Hi, thankieww for u helping but still have error, i'm a newbie in PowerShell, can u explain what does this mean?
Sep 04, 2023
I wrote this to parse the parse, quick but this works:
$toptenpage = Invoke-WebRequest -Uri https://www.fbi.gov/wanted/topten -UseBasicParsing
$urls = ($toptenpage.Links | Where-Object { $_.href -Match 'topten' -and $_.href -notmatch 'History' -and $_.href -notmatch 'faq' }).href | Sort-Object | Select-Object -Unique -Skip 2
foreach ($url in $urls) {
Invoke-WebRequest -Uri "$($url)/download.pdf" -UseBasicParsing -OutFile "c:\temp\$($url.Split('/')[5]).pdf"
}
This will save, create c:\temp if not already present, the top ten people in a .pdf file per person:
Please let me know if it works also for you and mark my answer as Solution to mark this topic as solved if it did