Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Get-HelloProjectDigitalBooks.ps1
- [System.IO.Directory]::SetCurrentDirectory([System.Environment]::GetFolderPath('Desktop'))
- $ie = New-Object -ComObject InternetExplorer.Application
- $ie.Visible = $true
- $ie.Navigate("http://www.helloproject-digitalbooks.com/")
- while ($ie.Busy) {
- Start-Sleep -Milliseconds 100
- }
- $volume = if ($ie.Document.documentElement.outerHTML -match '"sample/(\d+)/') { $Matches[1] }
- [void](Read-Host "Hello! Project digitalbooksのホームページが表示されたらログインし、その後にEnterキーを押してください。")
- $cookie = $ie.Document.cookie
- Write-Host "Volume: $volume"
- Write-Host "Cookie: $cookie"
- $webClient = New-Object System.Net.WebClient
- $webClient.Headers.Add("Cookie", $cookie)
- $url_format = "https://www.helloproject-digitalbooks.com/image.php?c=slide&v={0:d1}&id={1:d3}"
- $file_format = "$volume-{0:d1}-{1:d3}.jpg"
- foreach ($v in 1..4) {
- foreach ($id in 1..30) {
- $file = "No image"
- $data = $webClient.DownloadData(($url = $url_format -f $v, $id))
- if ($data.Length -gt 0) {
- [System.IO.File]::WriteAllBytes(($file = $file_format -f $v, $id), $data)
- }
- Write-Host "$url : $file"
- }
- }
- Write-Host "ダウンロードが終了しました。ブラウザを閉じてください。"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement