Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danwdart committed Jul 29, 2016
0 parents commit 4146b4d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TOKEN
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Get a token from https://developers.pinterest.com/tools/access_token/ with read access
and put it in a file named TOKEN.

Then run the script to download your pins.
28 changes: 28 additions & 0 deletions mine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
TOKEN=$(/bin/cat ./TOKEN)
HOST="https://api.pinterest.com"
PATH="/v1/me/pins/"
QUERY="access_token=$TOKEN&fields=id%2Cimage"
URI="$HOST$PATH?$QUERY"
if [[ $1 == *"cursor"* ]]
then
OUT=$(/usr/bin/curl $1 2>/dev/null)
else
OUT=$(/usr/bin/curl $URI 2>/dev/null)
fi
PARSED=$(echo $OUT | /bin/sed 's/https/\nhttps/g' | /bin/sed 's/".*//g')
for item in $PARSED
do
if [[ $item == *"pinimg"* ]]
then
/usr/bin/curl -O $item 2>/dev/null
elif [[ $item == *"cursor"* ]]
then
$0 $item
elif [[ $item == "{" ]]
then
echo Found new file
else
echo What is $item
fi
done

0 comments on commit 4146b4d

Please sign in to comment.