Advertisement
sxiii

ComputerUniverse Price Parser script for ArchLinux / Manjaro

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