Skip to content

Instantly share code, notes, and snippets.

@bfu4
Last active May 25, 2021 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfu4/549defe160ac8b8c0d9e160ffdb65276 to your computer and use it in GitHub Desktop.
Save bfu4/549defe160ac8b8c0d9e160ffdb65276 to your computer and use it in GitHub Desktop.
./waifuapi <endpoint> (Mac)
#!/bin/bash
cd ~/.Trash
NAME=`echo "$1" | awk -F/ '{print $4}'`
wget "$1" -q
viu ~/.Trash/"$NAME"
rm ~/.Trash/"$NAME"
#!/bin/bash
# Check args
if [[ -z "$1" ]]; then
echo "missing args"
exit -1
fi
out=`curl -s https://api.waifu.pics/sfw/"$1" | jq -r '.url'`
./viul "$out"
echo "$out" | pbcopy # URL goes to the clipboard
@bfu4
Copy link
Author

bfu4 commented May 25, 2021

Dependencies

  • viu
  • jq

viu

Will print a temporarily-downloaded retrieved image into the terminal

Install

$ cargo install viu

jq

Used to retrieve and parse JSON data

Install

$ brew install jq

@bfu4
Copy link
Author

bfu4 commented May 25, 2021

Example

@bfu4
Copy link
Author

bfu4 commented May 25, 2021

Would suggest iTerm for this to display correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment