Skip to content

Instantly share code, notes, and snippets.

@mnp
Created March 9, 2016 16:16
Show Gist options
  • Select an option

  • Save mnp/7acfe6b26d815a9c77a1 to your computer and use it in GitHub Desktop.

Select an option

Save mnp/7acfe6b26d815a9c77a1 to your computer and use it in GitHub Desktop.
export from pushbullet to a pile of json
#!/bin/bash
# see https://docs.pushbullet.com/#list-pushes
mytoken=$1
n=0
cursor=''
while true; do
curl --header "Access-Token: $mytoken" \
--data-urlencode active="true" \
--data-urlencode modified_after="1" \
$cursor \
--get \
https://api.pushbullet.com/v2/pushes > part${n}
gotcurs=$( jq ".cursor" part${n} | sed s/\"//g )
if [ $gotcurs == null ]; then
break
fi
sleep 1
cursor="--data-urlencode cursor=$gotcurs"
n=$[n + 1]
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment