sxiii icon

ComputerUniverse Price Parser script for ArchLinux / Manjaro

sxiii | PRO | 02/19/18 07:35:01 PM UTC | 0 ⭐ | 470 👁️ | Never ⏰ | []
Bash |

750 B

|

None

|

0 👍

/

0 👎

#!/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

Comments