Guest User

Untitled

a guest
Apr 15th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.16 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. wget http://bulbapedia.bulbagarden.net/wiki/List_of_Pok%C3%A9mon_by_National_Pok%C3%A9dex_number -O "lista"
  4. IFS=$'\n'
  5. i=0
  6. for linha in $(grep "<img.*width=\"40\"" lista); do
  7.     nome[${i}]=$(echo $linha | grep -o "title=\".*\">" | cut -c 8- | grep -o "[^\">]*")
  8.     url[${i}]=$(echo $linha | grep -o "href=\".*\" title" | cut -c 7- | grep -o "/wiki.*)")
  9.     img[${i}]=$(echo $linha | grep -o "src=\".*width" | cut -c 6- | grep -o "http:.*.png")
  10.     wget http://bulbapedia.bulbagarden.net${url[${i}]} -q -O tmp
  11.     tam[${i}]=$(grep -m 1 -o "td width=\"50%\"> [0-9.][0-9.][0-9.]* m" tmp | cut -c 17- | grep -o "[0-9.]*")
  12.     peso[${i}]=$(grep -m 1 -o "td width=\"50%\"> [0-9.][0-9.][0-9.]* kg" tmp | cut -c 17-  | grep -o "[0-9.]*")
  13.     echo -n "<img src=\"img/" >> out.htm
  14.     echo -n $(basename ${img[${i}]}) >> out.htm
  15.     echo -n "\" style=\"position: absolute; left: " >> out.htm
  16.     echo -n $(echo "100*${tam[${i}]}" | bc) >> out.htm
  17.     echo -n "px; top: " >> out.htm
  18.     echo -n $(echo "1075-${peso[${i}]}" | bc) >> out.htm
  19.     echo -n "px;\" title=\"" >> out.htm
  20.     echo -n ${nome[${i}]} >> out.htm
  21.     echo "\"/>" >> out.htm
  22.     i=$(($i+1))
  23. done
Advertisement
Add Comment
Please, Sign In to add comment