How to make a program download images of a site, page by page, using id?

3

I need to download several images from a site, where only the page number changes, but the id of the tag img is always the same.

I would like to know if you can create a program that does this download and page exchange, automatically .

The id is #backgroundImg . The ?page=96 page, for example. It can in any language or medium.

I made this code, but I still can not download it.

D:\>FOR %A IN (1,1,96) DO
    wget -A.jpg  http://www.servidor.com.br/#/edition/T3916843A?page=%Asection=1

I'm using wget in the prompt command.

    
asked by anonymous 16.05.2015 / 16:27

1 answer

1

The syntax of the loop for is incorrect, to declare and use a parameter of for prefix is required it with %% . You also need to use /L to range .

   
FOR /l %%A in (1, 1, 96) DO (
  :: Aqui você usa o wget para baixar o arquivo
  ECHO http://www.servidor.com.br/#/edition/T3916843A?page=%%Asection=1
)
PAUSE

Powershell

An alternative in Powershell:

1..96 | % { $paginas  += @{ $_ = "http://www.servidor.com.br/#/edition/T3916843A?page=$_'section=1"} }
$webClient = new-object System.Net.WebClient

foreach ($pagina in $paginas.getEnumerator()) {
   $webClient.DownloadFile($pagina.Value, "img$($pagina.Name)")
}
    
16.05.2015 / 21:24