Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # ComputerUniverse.ru Bash Price Parser
- # Add your item id's here:
- itemids=(90701841 90699890)
- # Do not change anything down there
- tmpfile="temp.html"
- url="https://www.computeruniverse.ru/products/"
- ## get item count using ${arrayname[@]} ##
- for m in "${itemids[@]}"
- do
- echo " ID: ${m}"
- curl -s -A "Mozilla/5.0" $url${m}/ > $tmpfile
- echo "NAME: $(grep $tmpfile -e 'document.title' | awk -F\' '{ print $2 }')"
- echo " USD: $(grep $tmpfile -e 'price' | awk -F'>' '{ print $3 }' | awk -F'<' '{ print $1 }' | sed '/^\s*$/d')"
- echo " RUB: $(grep $tmpfile -e 'price' | awk -F'oldpricebolditalic' '{ print $2 }' | awk -F'>' '{ print $2 }' | awk -F'&' '{ print $1 }' | sed '/^\s*$/d')"
- done
- rm $tmpfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement