#!/bin/bash # Directory where JSON will be saved OUTDIR="/var/www/EFT_COMPANION/public_html/" # Tarkov.dev endpoint URL="https://api.tarkov.dev/graphql" # PvP query read -r -d '' Q_PVP << 'EOF' { items { id name shortName avg24hPrice lastLowPrice low24hPrice high24hPrice } } EOF # PvE query read -r -d '' Q_PVE << 'EOF' { items(gameMode: pve) { id name shortName avg24hPrice lastLowPrice low24hPrice high24hPrice } } EOF # Pull PvP data curl -s -X POST -H "Content-Type: application/json" \ --data "{\"query\":\"${Q_PVP//$'\n'/ }\"}" \ "$URL" | jq '.data.items' > "$OUTDIR/items_pvp.json" # Pull PvE data curl -s -X POST -H "Content-Type: application/json" \ --data "{\"query\":\"${Q_PVE//$'\n'/ }\"}" \ "$URL" | jq '.data.items' > "$OUTDIR/items_pve.json" # Optional combined file jq -n \ --slurpfile pvp "$OUTDIR/items_pvp.json" \ --slurpfile pve "$OUTDIR/items_pve.json" \ '{updatedAt: now, pvp: $pvp[0], pve: $pve[0]}' \ > "$OUTDIR/tarkov_all.json"