-
-
Save yisraeldov/c1587fc04fd99c944f644e3675f8c97c to your computer and use it in GitHub Desktop.
Israel Post (דואר ישראל) command-line pacakge tracker
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
# -*- coding: utf-8 -*- | |
#!/bin/bash | |
for pkg in "$@"; do | |
echo -n "${pkg}: " | |
curl -s "http://www.israelpost.co.il/itemtrace.nsf/trackandtraceJSON?openagent&lang=EN&itemcode=${pkg}" | | |
python2 -c "import sys, locale, json; print (u' '+ json.load(sys.stdin)['itemcodeinfo'].split('<script')[0]).replace('<br>','').encode('utf8')" | |
done |
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
# Stick it somewhere and source it :) | |
pkg_tracker() { | |
for pkg in "$@"; do | |
echo -n "${pkg}: " | |
curl -s "http://www.israelpost.co.il/itemtrace.nsf/trackandtraceJSON?openagent&lang=EN&itemcode=${pkg}" | | |
python2 -c "import sys, json; print json.load(sys.stdin)['itemcodeinfo'].split('<script')[0]" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment