Skip to content

Instantly share code, notes, and snippets.

@Oisann
Last active March 5, 2022 01:44
Show Gist options
  • Save Oisann/d4d360283c0dba11dd1492a3b13e9d08 to your computer and use it in GitHub Desktop.
Save Oisann/d4d360283c0dba11dd1492a3b13e9d08 to your computer and use it in GitHub Desktop.
Requires curl and jq to be installed.
#/bin/bash
POST_NUMBER=$1
if [ -z "$POST_NUMBER" ]
then
POST_NUMBER="0655"
fi
echo "Post nummer: $POST_NUMBER"
echo -n "Posten kommer "
curl --silent "https://www.posten.no/levering-av-post/_/component/main/1/leftRegion/1?postCode=$POST_NUMBER" \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0" \
-H "Accept: */*" \
-H "Accept-Language: en-US,en;q=0.9,nb-NO;q=0.8,nb;q=0.6,no-NO;q=0.5,no;q=0.4,nn-NO;q=0.3,nn;q=0.1" \
-H "Accept-Encoding: gzip, deflate, br" \
-H "Referer: https://www.posten.no/levering-av-post" \
-H "content-type: application/json" \
-H "x-requested-with: XMLHttpRequest" \
-H "DNT: 1" \
-H "Connection: keep-alive" \
-H "Sec-Fetch-Dest: empty" \
-H "Sec-Fetch-Mode: no-cors" \
-H "Sec-Fetch-Site: same-origin" \
-H "Pragma: no-cache" \
-H "Cache-Control: no-cache" | jq -r "flatten | .[0]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment