Created
March 27, 2017 08:44
-
-
Save ad/c95e44eec812ca09b5074ad119edef9a to your computer and use it in GitHub Desktop.
Tracking EMS (Russian Post) parcel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: ems.sh <tracking> <sleep_duration> | |
export SLEEP=60 | |
export TRACKING="" | |
if [ $1 ]; then | |
TRACKING="$1" | |
else | |
echo "tracking must be in first parameter" | |
exit | |
fi | |
if [ $2 ]; then | |
if [ $2 \> "1" ]; then | |
SLEEP="$2" | |
fi | |
fi | |
echo "$TRACKING: $SLEEP" | |
while :; | |
do | |
clear | |
date | |
curl -s 'http://emspost.ru/ru/tracking.aspx/getEmsInfo' -H 'Origin: http://emspost.ru' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: ru,en-US;q=0.8,en;q=0.6,sr;q=0.4' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36' -H 'Content-Type: application/json; charset=UTF-8' -H 'Accept: */*' -H 'Referer: http://emspost.ru/ru/tracking/' -H 'Connection: keep-alive' -H 'DNT: 1' --data-binary "{\"emsNumber\":\"$TRACKING\"}"|jq .d|sed -e 's/<\/b>/-/g' -e 's/<[^>]*>//g' | |
# 's/<[^>]*>/\n/g' #'s/<[^>]\+>/\n/g' | |
sleep "$SLEEP" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment