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

# @describe Extract the content from a given URL.
# @option --url! The URL to scrape.

# @env JINA_API_KEY The api key
# @env LLM_OUTPUT=/dev/stdout The output path

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" "$@")"