Skip to content

Instantly share code, notes, and snippets.

@dannyob
Created September 19, 2023 01:47
Show Gist options
  • Save dannyob/2eb22f4112d8772b20425c34caebe1b9 to your computer and use it in GitHub Desktop.
Save dannyob/2eb22f4112d8772b20425c34caebe1b9 to your computer and use it in GitHub Desktop.
Grab a historical record of weights from a MyNetDiary account
# ssconvert is part of the gnumeric package -- apt or brew install gnumeric
cd /tmp/
PASSWORD=blahblahblah
USERNAME=test@example.com
JSESSIONID=$(curl 'https://www.mynetdiary.com/muiSignIn.do' -H 'accept: application/json, text/plain, */*' -H 'accept-language: en-US,en;q=0.7' -H 'content-type: application/json' -H 'origin: https://www.mynetdiary.com' -H 'referer: https://www.mynetdiary.com/logonPage.do' --data-raw '{"login": $USERNAME,"password":$PASSWORD,"rememberMe":true}' --compressed | jq -r .JSESSIONID)
curl --verbose -b JSESSIONID=$JSESSIONID 'https://www.mynetdiary.com/exportData.do?year=2023' --output mynetdiary.xls
ssconvert mynetdiary.xls -O 'sheet="Measurements"' measurements.csv
grep "Body Weight" < measurements.csv > weight.csv
rm -f mynetdiary.xls measurements.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment