A YouTube bot that will update the video title to match the view count.
Here’s the original YouTube video: https://www.youtube.com/watch?v=BxV14h0kFs0
And here’s my copy: https://www.youtube.com/watch?v=yza3FfiMupM
For now, my script is running as a cron job ervery 10 minutes (in order to stay under the 10,000 "units" per day limit).
![Screenshot 2023-06-12 164653](https://private-user-images.githubusercontent.com/91591901/245128205-9a23fd27-97bc-45fa-9b2a-7f09de30d87d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNDMwOTAsIm5iZiI6MTczOTE0Mjc5MCwicGF0aCI6Ii85MTU5MTkwMS8yNDUxMjgyMDUtOWEyM2ZkMjctOTdiYy00NWZhLTliMmEtN2YwOWRlMzBkODdkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDIzMTMxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFiNDFiNWY2YTY3ZDBhY2Y2MzcwY2YxNjIzMmY5OTU2ODU1MzYxM2FhYjI2ZDQ3ODZkM2EzZGRiNTg1MzNiZGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Wj4EZpXS1qDneXbYHg7iFI_ZBiysJKP39U2OiBBbjn4)
https://www.youtube.com/watch?v=j-bHvqQ378s&ab_channel=EngineerMan
Clone the repo locally
git clone https://github.com/lalitkumawat1m/YoutubeViewCounter.git
cd YoutubeViewCounter
Install the dependencies (via Yarn, or npm)
npm install
A lof of the code is copied over from https://developers.google.com/youtube/v3/quickstart/nodejs
-
Log into the Google Developers Console: https://console.developers.google.com/
-
Create New Project On the right side you should see a button to create a new project. I'll name mine "Youtube View Counter" Next, click "Create".
-
Enable the YouTube Data API v3 Click the "Enable APIs and Services" button
Search for "YouTube" and then enable the "YouTube Data API v3"
-
Generate Credentials Click the "Create Credentails" button
-
Set up consent screen Select "External" for the User Type
Fill out your Application Name, then hit "Save" at the very bottom
or run node index.js to start server
and deploy this server on cloud like render
If successful, your video title will be update after 10 minutes or if you can't wait then you can change time according to your own by reading 👇 node-corn documentation.
node-corn is used (here is full documentation https://www.npmjs.com/package/node-cron)
YouTube API limits By defauly, YouTube gives you 10,000 "units" per day on the API.
You can also calcualte your API costs here.
So for our purposes, the two API calls are:
videos.list.statistics = 3 units
videos.update.snippet = 53 units
For a total of 56 units per invocation.
So, if I have a bucket of 10,000 per day, and it costs 56 units each time, I can run it ~178 times per day.
With 1440 minutes in a day divided by 178, we can safely run the bot about every 8 miutes. We'll round up to 10 to be safe!
❤️ Found this project useful? If you found this project useful, then please consider giving it a ⭐ on Github and sharing it with your friends via social media.