Skip to content

sayedraminh/cloudae

Repository files navigation

YouTube Editor Payment Calculator

A web application that calculates payments for YouTube video editors based on view counts.

Payment Structure

  • 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)

Features

  • 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

Setup Instructions

Option 1: Simple Browser Method

  1. Clone this repository
  2. Open index.html directly 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

Option 2: Node.js Server (Recommended)

  1. Clone this repository
  2. Copy the .env.example file to .env (or create a new .env file)
  3. Add your YouTube API key to the .env file:
    YOUTUBE_API_KEY=your_youtube_api_key_here
    
  4. Install Node.js (version 14 or higher)
  5. Run npm install to install the dependencies
  6. Run npm start to start the server
  7. Open http://localhost:3000 in your browser

For development with auto-reload:

npm install -g nodemon
npm run dev

YouTube API Key Setup

To get accurate view counts from YouTube, you need a YouTube Data API v3 key:

  1. Go to the Google Cloud Console
  2. Create a new project (or select an existing one)
  3. In the left sidebar, go to "APIs & Services" > "Library"
  4. Search for "YouTube Data API v3" and select it
  5. Click "Enable" to enable the API for your project
  6. Go to "APIs & Services" > "Credentials"
  7. Click "Create Credentials" > "API Key"
  8. Your new API key will be displayed. Copy this key
  9. (Optional but recommended) Restrict the API key to only the YouTube Data API v3

Adding Your API Key

For Node.js server:

  • Add your API key to the .env file:
    YOUTUBE_API_KEY=your_youtube_api_key_here
    

For direct browser use:

  • Open the script.js file
  • 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';

Troubleshooting YouTube API Issues

If you're seeing incorrect view counts:

  1. Make sure simulation mode is disabled (the line window.fetchVideoData = simulateFetchVideoData should be commented out)
  2. Verify your API key is correctly entered
  3. Check if you've reached your daily quota limit for the YouTube API (default is 10,000 units per day)
  4. Note that YouTube API may show slightly different view counts than what appears on youtube.com due to caching and update delays

Development Mode

For testing without using your YouTube API quota, you can use the simulated data function:

  1. Open script.js
  2. Uncomment the line at the bottom: window.fetchVideoData = simulateFetchVideoData;

This will generate random view counts for testing purposes.

License

MIT

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors