Skip to content

Instantly share code, notes, and snippets.

@yisraeldov
Forked from 0xItx/pkg_tracker.sh
Last active December 27, 2016 09:35
Show Gist options
  • Save yisraeldov/c1587fc04fd99c944f644e3675f8c97c to your computer and use it in GitHub Desktop.
Save yisraeldov/c1587fc04fd99c944f644e3675f8c97c to your computer and use it in GitHub Desktop.
Israel Post (דואר ישראל) command-line pacakge tracker
# -*- 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
# 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