mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-04-05 18:09:04 +00:00
Add pipeline CMake, source, and fetch script
This commit is contained in:
27
pipeline/raw-data/fetch-breweries.sh
Executable file
27
pipeline/raw-data/fetch-breweries.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Fetch breweries data from OpenBreweryDB API and save to JSON files.
|
||||
# Saves results to misc/raw-data/breweries-complete.json
|
||||
|
||||
OUTPUT_DIR="misc/raw-data"
|
||||
API_BASE="https://api.openbrewerydb.org/v1/breweries"
|
||||
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
echo "Fetching breweries from OpenBreweryDB API..."
|
||||
echo "[]" > "$OUTPUT_FILE"
|
||||
|
||||
total_count=0
|
||||
|
||||
for page in {1..30}; do
|
||||
echo "Fetching page $page..."
|
||||
|
||||
curl -s "$API_BASE?per_page=200&page=$page" | \
|
||||
jq '.' > "$OUTPUT_DIR/page-$page.json"
|
||||
|
||||
count=$(jq 'length' "$OUTPUT_DIR/page-$page.json")
|
||||
total_count=$((total_count + count))
|
||||
echo " Got $count breweries (total: $total_count)"
|
||||
done
|
||||
|
||||
echo "Done fetching. Total breweries fetched: $total_count"
|
||||
Reference in New Issue
Block a user