Skip to content

HarshaAbeyvickrama/YouTube-Statistics

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

YouTube Statistics

YouTube Statistics Analyzer
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

YouTube Statistics is a project created to analyze YouTube videos and channels. This project can monitor the changes in views , likes, comments of a youtube video or new video uploads of a channel added to the database or the videos of the user uploads. This project is created in the purpose of automating the reseach work done around youtube statistics.

You can use this project freely and contribute to make it better

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Spreadsheet setup

  1. Make of copy of the spreadsheet here. It already contains the Apps Script code from this repository.Make a copy of the sheet to your drive and use the copied version.
  2. Change the name of the Project to aything you want.

YouTube Advanced Service setup

  1. From the spreadsheet, open the script editor by selecting Extensions > Apps Script.
  2. In the left-hand navigation pane, select + next to Services.
  3. Choose the YouTube Data API service, and click Add.
  4. Then Choose the Google Sheets API service, and click Add.

Making a local copy

Clone the YouTube-Statistics

  git clone https://github.com/HarshaAbeyvickrama/YouTube-Statistics.git

Apps Script trigger setup

  1. From the script editor, navigate to the left-hand vertical toolbar, and choose Triggers.
  2. In the bottom right-hand corner, click the +Add Trigger button.
  3. Under Run, select the updateVideoStatsTrigger function.
  4. Under Select event source, choose Time-driven.
  5. Under type, select Hour timer.
  6. Then select Every Hour. (This will run every hour of the day and update the view,like & comment count of videos)
  7. Optionally, adjust the Failure notification settings to configure how and when you are contacted by email if your triggered function fails.
  8. Click Save.
  9. Repeat from step 3 to 8 for the triggers updateChannelVideoStatsTrigger , updateUserChannelTrigger & updateChannelsTrigger .
  10. For updateUserChannelTrigger & updateChannelsTrigger use a weekly trigger.

Usage

Functions

  1. addUserVideos() : Add your uploads to the sheet to track.
  2. getUserVideos() : Returns a JSON response of all user uploaded videos.
  3. addPublicVideo(url,type) : Add a video with the link to the sheet to track.
  4. getPublicVideos() : Returns a JSON response of all videos that are added to the sheet with addPublicVideo() function
  5. getVideoStats(videoID) : Returns a JSON response of a particular video that is currently available in the database
  6. addNewChannel(ChannelLink) : Add a YouTube channel to the sheet to monitor. This function will add all videos in that channel to the database and it will monitor their views, comments & like count seperately.
  7. getChannel(channelID) : Returns a JSON response with the details a particular channel

Here, a separate sheet will be created with the name of the video ID for every video added to the sheet. This is applicable for all user videos and addition of channels

  1. resetDatabse() : Reset the database by clearing all the records in the main sheets and deleting all the extra sheets created for channels.

CORS Error

If you get a CORS error in your console you can fix that by following the below steps

  1. Create a new folder anywhere you want
  2. Copy the absolute path of that newly created folder
  3. Replace the path\to\your\folder with the path you just copied in runChrome.bat file.
  4. Then double click that runChrome.bat file and it will open a chrome window in web security diabled mode.There will a warning in the top of the browser. Just ignore that ☺
  5. You are good to go !

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Harsha Abeyvickrama - @VHAbeyvickrama - harshaabeyvickrama@gmail.com

Project Link: https://github.com/HarshaAbeyvickrama/YouTube-Statistics

Acknowledgements