aboutsummaryrefslogtreecommitdiffstats
path: root/tools/fetch_url_via_jina.sh
blob: add01eeb2a48911de32c5f53acc5b4e9f9da0e76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash
set -e

# @describe Extract the content from a given URL.

# @env JINA_API_KEY The api key
# @option --url! The URL to scrape.

main() {
    curl_args=()
    if [[ -n "$JINA_API_KEY" ]]; then
        curl_args+=("-H" "Authorization: Bearer $JINA_API_KEY")
    fi
    curl -fsSL "${curl_args[@]}" "https://r.jina.ai/$argc_url" >> "$LLM_OUTPUT"
}

eval "$(argc --argc-eval "$0" "$@")"