#!/bin/bash # Make VOIP data and numbers #set -x # Maker the file FILE=/tmp/voip.csv echo "url;country;type;incl;excl" > $FILE # Get it all #{{{ GETIT () { URL=`echo $LINK|awk -F/ '{print $3}'` lynx -source $LINK|sed 's#\^#\n#g' | \ egrep 'landline|mobile' | \ grep -v option | \ egrep -v "Make cheap calls|free*|\+mobile" |\ sed -e 's/<[^>]*>//g' | \ sed -e 's/ /;/g' | \ sed -e 's/(/;/g' | \ sed -e 's/)/;/g' | \ sed -e 's/ SuperDeal\!\*\*//g' | \ sed -e 's/ SuperDeal\!//g' | \ sed -e 's/FREE\*/0/g' | \ sed -e "s/^/${URL};/g" | \ sed -e 's/;;/;/g' | \ sed -e 's/;;/;/g' | \ sed -e 's/ \[/;/g' | \ sed -e 's/ & / and /g' | \ sed -e 's/\]//g' >> $FILE } #}}} BUDGETSIP () #{{{ { LINK=http://www.budgetsip.com/en/calling-rates.html URL=`echo $LINK|awk -F/ '{print $3}'` lynx -source $LINK|sed 's#\^#\n#g' | \ egrep 'landline|mobile' | \ grep -v "DID NOT FIND COUNTRY" | \ grep -v "Make cheap calls" | \ sed -e 's/<[^>]*>//g' | \ sed -e 's/ /;/g' | \ sed -e 's/ - /;/g' | \ sed -e "s/^/${URL};/g" | \ sed -e 's/;;/;/g' | \ sed -e 's/;Fixed[^\;]*\;/;;;Landline;/g' | \ sed -e 's/;Mobile[^\;]*\;/;;;Mobile;/g' | \ sed -e 's/;Universal[^\;]*\;/;;;Landline;/g' | \ sed -e 's/;;;/;/g' | \ egrep -i 'landline|mobile' >> $FILE } #}}} VOIPIAN () #{{{ { LINK=http://www.voipian.com/en/rates.php URL=`echo $LINK|awk -F/ '{print $3}'` lynx -source $LINK |\ perl -p -i -e 's/td>\n//g' | \ egrep 'landline|mobile' | \ sed -e 's/\t//g' | \ sed -e 's##;#g' | \ sed -e 's/<[^>]*>//g' | \ sed -e 's/(/;/g' | \ sed -e 's/)/;/g' | \ sed -e 's#1 Cent/Call\*#0#g' | \ sed -e 's/ /0/g' | \ egrep -v "destinations|\+mobile" | \ sed -e "s/^/${URL};/g" | \ sed -e 's/ ;/;/g' | \ sed -e 's/;Us;//g' | \ sed -e 's/Germany mobile/Germany;mobile;/g' >> $FILE } #}}} # Non standard stuff#{{{ NON () { http://www.sparvoip.de/de/calling-rates.html German screws stuff up http://www.netappel.fr/fr/calling-rates.html French screws stuff up http://www.voipblast.com/en/rates.php Non standard page } #}}} #{{{ All the links BUDGETSIP VOIPIAN LINKS=" http://www.12voip.com/en/calling-rates.html http://www.actionvoip.com/en/calling-rates.html https://www.calleasy.com/en/rates.html http://www.dialnow.com/en/calling-rates.html http://www.freecall.com/en/calling-rates.html http://www.internetcalls.com/en/calling-rates.html http://www.intervoip.com/en/calling-rates.html http://www.jumblo.com/en/calling-rates.html http://www.justvoip.com/en/calling-rates.html http://www.lowratevoip.com/en/calling-rates.html http://www.nonoh.net/en/calling-rates.html http://www.poivy.com/en/calling-rates.html http://www.rynga.com/en/calling-rates.html http://www.sipdiscount.com/en/calling-rates.html http://www.smartvoip.com/en/calling-rates.html http://www.smsdiscount.com/en/calling-rates.html http://www.smslisto.com/en/calling-rates.html http://www.voipbusterpro.com/en/calling-rates.html http://www.voipcheap.co.uk/en/rates.html http://www.voipcheap.com/en/calling-rates.html http://www.voipdiscount.com/en/calling-rates.html http://www.voipraider.com/en/calling-rates.html http://www.voipstunt.com/en/calling-rates.html http://www.voipwise.com/en/calling-rates.html http://www.voipzoom.com/en/calling-rates.html http://www.webcalldirect.com/en/calling-rates.html http://www.telbo.com/en/calling-rates.html http://www.voipgain.com/en/calling-rates.html http://www.powervoip.com/en/calling-rates.html " for LINK in $LINKS do GETIT done #}}} # Clean up some stuff egrep -v 'System|0ct|5ct|\;$|\{|\; ' $FILE > $FILE.tmp mv $FILE.tmp $FILE grep -vP ';\t' $FILE > $FILE.tmp mv $FILE.tmp $FILE echo "made $FILE" set -x #Make the database up to date #mysql -u root -p VoiP -e "TRUNCATE TABLE VoIP" #mysqlimport -u root -p VoiP -e "load data local infile $FILE into table VoIP fields terminated by ';' lines terminated by '\n'"