Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PowerShellっぽく陸上自衛隊のイラク派遣日報をまとめてダウンロードしてみる (同期処理)
(Invoke-WebRequest -Uri https://www.asahi.com/articles/ASL4J669JL4JUEHF016.html).Links.href | Where {$_.EndsWith(".pdf")} | Sort-Object -Unique -PipelineVariable pdf | ForEach{ Start-Job {param($uri,$file,$path) cd $path; Invoke-WebRequest -Uri $uri -OutFile $file} -ArgumentList $pdf,$pdf.Split("ichikijiatesi/").Replace("/","_")[1]),$pwd}
(Invoke-WebRequest -Uri https://www.asahi.com/articles/ASL4J669JL4JUEHF016.html).Links.href | Where {$_.EndsWith(".pdf")} | Sort-Object -Unique | ForEach {Invoke-WebRequest -Uri $_ -OutFile ($_.Split("ichikijiatesi/").Replace("/","_"))[1]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment