-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4146b4d
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |