You can make use of YouTube API to grab details of YouTube videos. Although, more complex script requires you to setup authentication using OAuth, it is not required for simple tasks, such as collecting views of few videos.
This spreadsheet sends you an email notification whenever the number of views on YouTube videos gets higher than the threshold set by you. The videos need not be yours, you can monitor anyone’s video – you just need to grab their video ID. I saw a question on StackExchange related to this and just coded it for fun.
Go to YouTube Views Notification spreadsheet. Click on File > Make a copy. Give it any name you like; doesn’t matter.
Click on “YouTube Views Notification” menu on the top and select “Options”.
It will ask for authorization, click on OK. Repeat the above step – go to the menu and select “Options”.
You will be asked to provide views count threshold and your email address.
Now, on the first column of the spreadsheet, enter the video ID of the videos whose view count you’d like to monitor. Video ID is the text after “=” on the URL. For eg. on this URL : http://www.youtube.com/watch?v=XXXXXXXXX, the X’s on the end represent the video ID.
To check whether it works or not, click the Run option under “YouTube Views Notification” menu. If the video has more views than the threshold set by you, you should receive an email immediately. After an email is sent, the associated video ID is removed. This is to make sure that you don’t receive more emails for the same video.
To make the script run at a fixed period of time automatically, just go to Tools > Script Editor. Once there, go to “Resources > Current Project’s Triggers”. Click on “Add a new trigger”, select “ytViewAlert” from the drop down list under Run. Select “Time Driven” under Events and then select the timer that suits you the best. I’d recommend a day timer. Click on save once you’re done.
Now relax. The script will run as per the timer you provided and you’ll receive an email notification when the views crosses the threshold that you set earlier.