sinhala-subtitle-hardcoder / PIXELDRAIN_API_KEY_GUIDE.md
000x's picture
FI
c4508fd
|
Raw History Blame Contribute Delete
5.52 kB

πŸ”‘ PixelDrain API Key Setup Guide

Why Use API Key?

Without API Key (Anonymous Upload):

  • ⚠️ Files deleted after 7 days
  • ⚠️ Not linked to your account
  • ⚠️ Cannot manage or delete files
  • ⚠️ Limited to small files

With API Key (Authenticated Upload):

  • βœ… Permanent storage (until you delete)
  • βœ… Files appear in your PixelDrain account
  • βœ… Full file management (rename, delete, organize)
  • βœ… Higher upload limits
  • βœ… Better bandwidth
  • βœ… Track all your uploads

How to Get Your API Key

Step 1: Create PixelDrain Account

  1. Go to https://pixeldrain.com/register
  2. Sign up (free account is fine)
  3. Verify your email

Step 2: Generate API Key

  1. Login to PixelDrain
  2. Go to https://pixeldrain.com/user/api_keys
  3. Click "Create API Key"
  4. Give it a name (e.g., "Subtitle Hardcoder")
  5. Click "Create"
  6. Copy the API key (it looks like: abc123def456...)

Step 3: Use the API Key

Option A: Enter in Web Form

  1. Paste your API key in the "PixelDrain API Key" field
  2. Process your videos
  3. Videos will upload to YOUR account

Option B: Set as Environment Variable (Recommended for Hugging Face)

  1. Go to your Hugging Face Space Settings
  2. Click "Repository secrets"
  3. Add new secret:
    • Name: PIXELDRAIN_API_KEY
    • Value: Your API key
  4. Save
  5. Now all uploads will use your account automatically!

Using API Key in Different Ways

1. Web Interface

Just paste your API key in the form field:

πŸ”‘ PixelDrain API Key: abc123def456...

2. Environment Variable (Hugging Face Spaces)

In Hugging Face Space:

  1. Settings β†’ Repository secrets
  2. Add: PIXELDRAIN_API_KEY = your key
  3. Restart Space
  4. All uploads now authenticated automatically!

In Docker/Local:

export PIXELDRAIN_API_KEY="your_api_key_here"
python app.py

In Dockerfile:

ENV PIXELDRAIN_API_KEY="your_api_key_here"

3. Programmatically (Python)

processor = VideoSubtitleProcessor()
links, paths = processor.process_multiple_videos(
    video_urls, 
    subtitle_path,
    api_key="your_api_key_here"
)

Security Best Practices

βœ… DO:

  • Store API key in environment variables
  • Use Hugging Face Repository secrets
  • Keep API key private
  • Regenerate if compromised

❌ DON'T:

  • Commit API key to Git
  • Share API key publicly
  • Include in screenshots
  • Hard-code in source files

Managing Your Uploads

Once uploaded with API key, manage your files at:

Troubleshooting

"Upload failed" with API key

  • Check: API key is correct (no extra spaces)
  • Check: Account is active and verified
  • Check: File size within account limits
  • Try: Regenerate API key

API key not working

  • Verify: Key copied correctly
  • Verify: No line breaks or spaces
  • Check: Account status at pixeldrain.com
  • Test: Try anonymous upload first

Uploads not showing in account

  • Check: API key is actually being used
  • Check: Look for "πŸ” Authenticated Upload" message
  • Wait: May take a few seconds to appear
  • Refresh: PixelDrain files page

Example Workflows

For Personal Use (Private)

  1. Set PIXELDRAIN_API_KEY in Hugging Face Space secrets
  2. Make Space private
  3. All your uploads automatically saved to your account
  4. Manage files easily from PixelDrain

For Public Use (Shared Space)

  1. Don't set environment variable
  2. Users enter their own API keys
  3. Each user's files go to their own account
  4. Anonymous uploads for users without keys

For Team Use

  1. Create dedicated PixelDrain account
  2. Set API key in Space secrets
  3. All team uploads centralized
  4. Easy file management

API Key Format

PixelDrain API keys look like:

abc123def456ghi789jkl012mno345pqr678stu901
  • Long alphanumeric string
  • No spaces or special characters
  • Case-sensitive
  • Keep it secret!

Benefits Summary

Feature Anonymous With API Key
Storage Duration 7 days Permanent
File Management ❌ No βœ… Yes
Account Integration ❌ No βœ… Yes
Upload Limits Low Higher
Bandwidth Limited Better
Organize Files ❌ No βœ… Yes
Delete Old Files ❌ No βœ… Yes

Quick Setup Commands

Set in Hugging Face Space:

# In Space Settings β†’ Repository secrets
PIXELDRAIN_API_KEY = your_api_key_here

Set in Local Terminal:

# Linux/Mac
export PIXELDRAIN_API_KEY="your_api_key_here"

# Windows CMD
set PIXELDRAIN_API_KEY=your_api_key_here

# Windows PowerShell
$env:PIXELDRAIN_API_KEY="your_api_key_here"

Check if API key is set:

# Linux/Mac/Windows PowerShell
echo $PIXELDRAIN_API_KEY

# Windows CMD
echo %PIXELDRAIN_API_KEY%

Need Help?

  1. PixelDrain Support: support@pixeldrain.com
  2. API Documentation: https://pixeldrain.com/api
  3. Account Issues: https://pixeldrain.com/contact

πŸŽ‰ Ready to Use!

  1. Get your API key from pixeldrain.com/user/api_keys
  2. Add it to the form OR set as environment variable
  3. Enjoy permanent storage and full file management!

Pro Tip: Set it as environment variable in Hugging Face Space secrets for automatic authenticated uploads every time!


Made with ❀️ for the Sinhala-speaking community