The Bestsellers list is HUGE, gigabytes of data every day, you don't want to use the (slow) Content API to access that.
From that point on we just get the data we need from BigQuery, which works easier and more versatile than using the Content API.
On a sidenote: you have your merchantId in the script, which is sensitive information.
On sidenote 2: clear your bestsellers data every few days, because storage in bigquery is not that expensive, but if you keep it for months and months it starts to become expensive :D
Greetings,
Hans