Skip to content

Commit

Permalink
Add PIXABAY wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
kraasch committed Mar 1, 2024
1 parent 83de216 commit 937e1a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ hub_update:
@hub_ctrl ${HUB_MODE} ln "$(realpath ./src/wrappers/curl/web_goodreads)"
@hub_ctrl ${HUB_MODE} ln "$(realpath ./src/wrappers/curl/web_sunmap)"
@hub_ctrl ${HUB_MODE} ln "$(realpath ./src/wrappers/curl/web_yt_get_id)"
@hub_ctrl ${HUB_MODE} ln "$(realpath ./src/wrappers/curl/web_pixabay)"
@hub_ctrl ${HUB_MODE} ln "$(realpath ./src/wrappers/git/git_commit_past)"
@hub_ctrl ${HUB_MODE} ln "$(realpath ./src/wrappers/misc/sxiv_rm)"
@hub_ctrl ${HUB_MODE} ln "$(realpath ./src/wrappers/python_requests/web_tatoeba)"
Expand Down
14 changes: 14 additions & 0 deletions src/wrappers/curl/web_pixabay
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /bin/bash

BEG='https://pixabay.com/api/?key=19800860-fd81fde52b5686725fdcf6309&q='
END='&image_type=photo'
PREFIX_1='largeImageURL":"'
PREFIX_2='https:'

word="$1"
if $(test -z "$word"); then
word='toast'
fi

images=$(curl -s "$BEG${word}$END" | grep -oE "$PREFIX_1[^\"]*" | grep -oE "$PREFIX_2[^\"]*" | head -5)
echo "$images"

0 comments on commit 937e1a1

Please sign in to comment.