Skip to content

Instantly share code, notes, and snippets.

@cquest
cquest / adresse-francaise-optout.sh
Created May 26, 2016 12:46
script to opt-out data from adresse-francaise.com
#!/bin/bash
# script to opt-out data from adresse-francaise.com
# usage: ./adresse-francaise-optout.sh <insee>
insee=$1
fantoir=`curl -s "http://adresse-francaise.com/search.php?c=$insee" | egrep '<a href="street.php.i=[0-9][0-9AB][0-9]{3}[0-9A-Z][0-9]{3}' -o | sed 's/^.*=//'`
for f in $fantoir; do
echo $f
tel=`curl "http://adresse-francaise.com/street.php?i=$f" -s | egrep "<td>[0-9]{10}" -o | sed 's/<td>//'`
for t in $tel; do
curl 'http://adresse-francaise.com/btob.php' -H 'Host: adresse-francaise.com' --compressed -H 'Referer: http://adresse-francaise.com/contact.php' -H 'Connection: keep-alive' --data "phone=$t" -s > /dev/null