Skip to content

Instantly share code, notes, and snippets.

@kamuridesu
Created February 10, 2025 20:59
Show Gist options
  • Select an option

  • Save kamuridesu/d546893a29976def4440b03d48223fe6 to your computer and use it in GitHub Desktop.

Select an option

Save kamuridesu/d546893a29976def4440b03d48223fe6 to your computer and use it in GitHub Desktop.
Track samsung packages
OLD_MESSAGE_SHA=""
TRACKING_NO=""
LSS_ID=""
while true; do
RESULT=$(curl -sSL 'https://plusla.samsungscl.com/cello/tms/integration/json/TMS_PEXT_EX_0029' --compressed -X POST -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:134.0) Gecko/20100101 Firefox/134.0' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: https://plusla.samsungscl.com' -H 'DNT: 1' -H 'Connection: keep-alive' -H "Referer: https://plusla.samsungscl.com/cello/tms/html/tms/prime/ext/TmsTrackAndTraceBrExt.html?TRACKING_NO=${TRACKING_NO}" -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data-raw "{\"shprOrderNo\":\"${TRACKING_NO}\",\"lssId\":\"${LSS_ID}\"}")
ITEM=$(echo "$RESULT" | jq ".itens[0].desc")
DEST=$(echo "$RESULT" | jq ".destinationAddress")
SRC=$(echo "$RESULT" | jq ".sourceAddress")
CARRIER=$(echo "$RESULT"| jq ".carrierCompany")
MERGED_EVENTS=$(echo "$RESULT" | jq -r '.events[] | "\(.label): \(.date)"')
MESSAGE="RASTREAMENTO SAMSUNG
ITEM: $ITEM
CARRIER: $CARRIER
ORIGIN: $SRC
DESTINATION: $DEST
UPDATES:
$MERGED_EVENTS
"
MESSAGE_SHA=$(echo "$MERGED_EVENTS" | sha256sum | cut -d" " -f 1)
if [[ "$MESSAGE_SHA" != "$OLD_MESSAGE_SHA" ]]; then
OLD_MESSAGE_SHA="$MESSAGE_SHA"
echo "$MESSAGE"
notify-send "Samsung Tracking" "$MESSAGE" -t 5000
fi
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment