Jump to content

Porous6937

Member
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Porous6937

  1. Thank you for the quick help guys! @Stephen_C you are right that's what I should 've done from the beginning! Not good at coding though. The output is the following @Terminal Thanks for the guidance but I am not familiar with coding in any language @vitor You got me! I am not familiar with coding and I asked chatGPT. 🥴 I have installed python 3 and all other projects I have work with python. I tried replacing the code with the one you wrote but didn't have any success. I'll guess I'll try the python only way... Thank you all for your tips and thoughts! You have a very nice community here!
  2. Hi there! I am trying to create a workflow in Alfred that search a keyword and returns a relevant photo from unsplash using the unsplash api. #!/usr/bin/env bash # Set Unsplash API key export UNSPLASH_ACCESS_KEY="enter your unsplash key" # Get query from Alfred query="$1" # URL encode query query="$(echo "$query" | python -c 'import urllib.parse; print(urllib.parse.quote(input()))')" # Search for images on Unsplash using the Unsplash API response=$(curl --silent "https://api.unsplash.com/search/photos?query=$query&client_id=$UNSPLASH_ACCESS_KEY") # Parse the JSON response to get the URLs of the first 10 images urls=$(echo "$response" | jq -r '.results[0:10] | .[].urls.regular') # Output the URLs as JSON for Alfred echo "$urls" | jq -R -s 'split("\n") | map(select(length > 0)) | map({title: ., arg: .})' The workflow doesn't run as expected. Does anyone know what may be wrong?
×
×
  • Create New...