thaduck

Untitled

Feb 9th, 2015
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.71 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. TEMP=`mktemp`
  4. ( curl -s "http://www.geldvoorelkaar.nl/geld-investeren/projecten.aspx?orderby=7&page=1" && curl -s "http://www.geldvoorelkaar.nl/geld-investeren/projecten.aspx?orderby=7&page=2") | grep -o 'LeningIdLabel.>[0-9]*' | egrep -o '[0-9]+' | sort > $TEMP
  5.   KNOWNFILE=/tmp/knownids.txt
  6.   ADDRS=/tmp/addrs.txt
  7. # create addrs.txt and add 1 mail address per line
  8.  
  9.   while read num; do
  10.     if grep -q $num $KNOWNFILE; then
  11.       continue
  12.     else
  13.  
  14.      curl -s "http://www.geldvoorelkaar.nl/geld-investeren/projecten/project.aspx?id=$num" > /tmp/$num
  15.      NAAM=`cat /tmp/$num | grep -o 'ProjectNaamLabel.>[a-zA-Z ]*' | cut -d ">" -f 2`
  16.      LEENDOEL=`cat /tmp/$num | grep -o 'LeendoelLabel.>[a-zA-Z ]*' | cut -d ">" -f 2`
  17.      BEDRAG=`cat /tmp/$num | grep -o 'BedragLabel.>[^\d]*' | cut -d ">" -f 2 | cut -d "<" -f 1 | cut -d " " -f 2`
  18.      RENTE=`cat /tmp/$num | grep -o 'RenteLabel.>[^\d]*' | cut -d ">" -f 2 | cut -d "<" -f 1`
  19.      LOOPTIJD=`cat /tmp/$num | grep -o 'LooptijdLabel.>[0-9a-zA-Z ]*' | cut -d ">" -f 2`
  20.      CLASSIFICATIE=`cat /tmp/$num | grep -o 'ClassificatieLabel.*>[A-Z]*' | cut -d ">" -f 2 | cut -d "<" -f 1`
  21.      GRAYDON=`cat /tmp/$num | grep -o 'GraydonRatingLabel.*>[A-Z]*' | cut -d ">" -f 2 | cut -d "<" -f 1`
  22.  
  23.  
  24.     while read mailaddr; do
  25.       echo "Nieuw project op geldvoorelkaar: http://www.geldvoorelkaar.nl/geld-investeren/projecten/project.aspx?id=$num
  26.  
  27. Naam: $NAAM
  28. Leendoel: $LEENDOEL
  29. Bedrag: $BEDRAG euro
  30. Rente: " $RENTE"
  31. Looptijd: $LOOPTIJD
  32. Classsificatie: $CLASSIFICATIE
  33. Graydon rating: $GRAYDON
  34.  
  35. Afmelden? [email protected]" | mail -s "Nieuw project op geldvoorelkaar.nl [$num]" $mailaddr
  36.       done < $ADDRS
  37.  
  38.       echo $num >> $KNOWNFILE
  39.     fi
  40.   done < $TEMP
Advertisement
Add Comment
Please, Sign In to add comment