Skip to content

Instantly share code, notes, and snippets.

@hugosenari
Last active February 10, 2021 22:20
Show Gist options
  • Save hugosenari/775386e57b9ffb3b37ff3ce1a3e95114 to your computer and use it in GitHub Desktop.
Save hugosenari/775386e57b9ffb3b37ff3ce1a3e95114 to your computer and use it in GitHub Desktop.
Random Gif URL
#!/bin/bash
GIF_RATING="${GIF_RATING=pg-13}"
GIF_TAG="${GIF_TAG=so-excited}"
curl -s 'https://api.giphy.com/v1/gifs/random?api_key='$GIPHY_TOKEN'&tag='$GIF_TAG'&rating='$GIF_RATING | \
sed -E 's/.*image_original_url":"([^"]+)".*/\1\n/gi' | \
tr -d '\\'
@hugosenari
Copy link
Author

hugosenari commented Jan 27, 2021

Use it like this

GIPHY_TOKEN=AAAAAAAAAAAAA  \
curl -s https://gist.githubusercontent.com/hugosenari/775386e57b9ffb3b37ff3ce1a3e95114/raw/27baa02a805238c483029d6ade7bad9b723a89b1/random_gif_url.sh|bash -s

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