23 lines
666 B
Bash
23 lines
666 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
mkdir -p data
|
||
|
|
||
|
echo "Login to CodiMD"
|
||
|
curl -c cookiefile "$CMD_SERVER_URL/login" -X POST -H "Referer: $CMD_SERVER_URL/" --data-raw "email=$CMD_EMAIL&password=$CMD_PASSWORD" >/dev/null
|
||
|
|
||
|
echo
|
||
|
echo
|
||
|
|
||
|
curl -b cookiefile 'https://codimd.zeus.gent/me' | jq
|
||
|
echo
|
||
|
notes_history=$(curl -b cookiefile 'https://codimd.zeus.gent/history')
|
||
|
|
||
|
# echo $notes_history | jq
|
||
|
# note_id=$(echo "$notes_history" | jq -r '.history[1].id')
|
||
|
ids=$(echo "$notes_history" | jq -r '.history | map(.id) | .[]')
|
||
|
|
||
|
while IFS= read -r line; do
|
||
|
echo "... Reading note with ID: $line ..."
|
||
|
curl -b cookiefile "https://codimd.zeus.gent/$line/download" >"data/note-$line.md"
|
||
|
done <<<"$ids"
|