Follow these steps to set up the project:
- Follow the instructions in this guide to create OAuth tokens in Google Cloud for the YouTube Data API: Create OAuth Tokens.
- Continue following the guide until step 7: Replicate Tom Scott's "This Video Has X Views" Videos with Node.js.
- Clone this repository and create your own
.env
file with the necessary environment variables. - Update the video ID in
updatetitle.js
with your own video ID. - Deploy the project to Vercel.
- Create a cron job on cron-job.org. The URL for the cron job should be
https://yourvercel.app/api/updatetitile
. - Enjoy!
Every week after the refresh token expires:
- Run
main.js
to get a new refresh token. - Copy the new refresh token.
- Update the refresh token in Vercel's environment variables.
- Redeploy your Vercel instance.
- Re-enable the cron job.