Sep 04 2023 12:55 AM
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 update everyday so if i want download all the file how can i write. Cuz if i just use the link https://www.fbi.gov/wanted/topten is will jump out the message:Content-Disposition header not found for URL: https://www.fbi.gov/wanted/topten
Sep 04 2023 03:59 AM - edited Sep 05 2023 11:49 AM
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
Sep 04 2023 05:37 AM
Solution@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 05:40 AM - edited Sep 04 2023 05:40 AM
Ah, there seems to be a policy in place on your system. Does it work if you run Set-ExecututionPolicy Bypass and then run the script in the same PowerShell prompt?
Sep 04 2023 05:48 AM
Sep 04 2023 05:52 AM
Sep 04 2023 06:04 AM
Sep 06 2023 08:46 PM
Sep 07 2023 01:17 AM
Sep 07 2023 01:50 AM
Sep 07 2023 01:54 AM
Sep 07 2023 02:07 AM
for this link: https://www.un.org/securitycouncil/content/un-sc-consolidated-list
here have the download pdf download button, is that possible to get the button link or what and download the file, because jn i use the link, then the message say:the link cannot find the file. or also need to import the Selenium? Because based on my research if the need action with the web browser so need to import Selenium
Sep 07 2023 02:56 AM
Sep 07 2023 03:38 AM
Sep 07 2023 07:08 AM
Sep 12 2023 02:40 AM
@Harm_Veenstra hi sry again to bother u.last time u send me the code, on that day I can run,but tdy I don’t know why can’t can u try on ur site ?