Permalink
Browse files

* postal-tracking: retry logic added

  • Loading branch information...
l29ah committed Sep 5, 2012
1 parent 34db9a1 commit c3ef76a099108ed6fb47c5f51c484d6e5a34be5e
Showing with 5 additions and 1 deletion.
  1. +5 −1 russianpost.ru/postal-tracking
@@ -1,2 +1,6 @@
#!/bin/bash
Xtract '//table[@class="pagetext"]/tbody/tr/td/-' <(curl -s 'http://www.russianpost.ru/resp_engine.aspx?Path=rp/servise/ru/home/postuslug/trackingpo' -d 'OP=&PATHCUR=rp%2Fservise%2Fru%2Fhome%2Fpostuslug%2Ftrackingpo&PATHFROM=&WHEREONOK=&ASP=&PARENTID=&FORUMID=&NEWSID=&DFROM=&DTO=&CA=&CDAY=&CMONTH=&CYEAR=&NAVCURPAGE=&SEARCHTEXT=&searchAdd=&PATHWEB=RP%2FINDEX%2FRU%2FHome&PATHPAGE=RP%2FINDEX%2FRU%2FHome%2FSearch&search1=&BarCode='"$1"'&searchsign=1&entryBarCode=') | htmldecode
f="`tempfile`"
trap "rm \"$f\"" EXIT
curl -s 'http://www.russianpost.ru/resp_engine.aspx?Path=rp/servise/ru/home/postuslug/trackingpo' -d 'OP=&PATHCUR=rp%2Fservise%2Fru%2Fhome%2Fpostuslug%2Ftrackingpo&PATHFROM=&WHEREONOK=&ASP=&PARENTID=&FORUMID=&NEWSID=&DFROM=&DTO=&CA=&CDAY=&CMONTH=&CYEAR=&NAVCURPAGE=&SEARCHTEXT=&searchAdd=&PATHWEB=RP%2FINDEX%2FRU%2FHome&PATHPAGE=RP%2FINDEX%2FRU%2FHome%2FSearch&search1=&BarCode='"$1"'&searchsign=1&entryBarCode=' > "$f"
grep -q '<head></head>' "$f" && rm -rf "$f" && exec "$0" "$1"
Xtract '//table[@class="pagetext"]/tbody/tr/td/-' "$f" | htmldecode

0 comments on commit c3ef76a

Please sign in to comment.