#!/bin/bash
d="03"
cl=(AU BR CA DE ES GB IT MX US)
token=$TOKEN
echo $token
for c in "${cl[@]}"
do
  flnm="streams_202012${d}_${c}"
  flnm_gz="${flnm}.gz"
  flnm_json="${flnm}.json"
  u="curl --location --request GET 'https://provider-api.spotify.com/v1/analytics/sonybmgmusicentertainment/enhanced/streams/2020/12/$d/$c' --header 'Authorization: Bearer ${token}' --output ${flnm_gz}"
  echo $u
  eval $u
  eval "aws s3 cp ${flnm_gz} s3://sme-data-archive/spotify/streams/v4/report_date=2020-12-${d}/report_licensor=sme/"
done
