A web application that calculates payments for YouTube video editors based on view counts.
- Base price: $5 per edit (videos under 1M views)
- +$2 for each million views up to and including 5M (1M..5M)
- +$3 for each million views after 5M (starting at 6M)
- Add up to 30 YouTube videos by URL
- Automatically fetches view counts for each video
- Calculates payment for each video based on the payment structure
- Shows total payment for all videos
- Clone this repository
- Open
index.htmldirectly in your browser- The application will use the included YouTube API key
- If you need to use your own API key, see the "API Key Setup" section below
- Clone this repository
- Copy the
.env.examplefile to.env(or create a new.envfile) - Add your YouTube API key to the
.envfile:YOUTUBE_API_KEY=your_youtube_api_key_here - Install Node.js (version 14 or higher)
- Run
npm installto install the dependencies - Run
npm startto start the server - Open
http://localhost:3000in your browser
For development with auto-reload:
npm install -g nodemon
npm run dev
To get accurate view counts from YouTube, you need a YouTube Data API v3 key:
- Go to the Google Cloud Console
- Create a new project (or select an existing one)
- In the left sidebar, go to "APIs & Services" > "Library"
- Search for "YouTube Data API v3" and select it
- Click "Enable" to enable the API for your project
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "API Key"
- Your new API key will be displayed. Copy this key
- (Optional but recommended) Restrict the API key to only the YouTube Data API v3
For Node.js server:
- Add your API key to the
.envfile:YOUTUBE_API_KEY=your_youtube_api_key_here
For direct browser use:
- Open the
script.jsfile - Replace the API key in this line:
const API_KEY = typeof process !== 'undefined' && process.env ? process.env.YOUTUBE_API_KEY : 'your_youtube_api_key_here';
If you're seeing incorrect view counts:
- Make sure simulation mode is disabled (the line
window.fetchVideoData = simulateFetchVideoDatashould be commented out) - Verify your API key is correctly entered
- Check if you've reached your daily quota limit for the YouTube API (default is 10,000 units per day)
- Note that YouTube API may show slightly different view counts than what appears on youtube.com due to caching and update delays
For testing without using your YouTube API quota, you can use the simulated data function:
- Open
script.js - Uncomment the line at the bottom:
window.fetchVideoData = simulateFetchVideoData;
This will generate random view counts for testing purposes.
MIT