File size: 5,522 Bytes
c4508fd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | # π 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:**
```bash
export PIXELDRAIN_API_KEY="your_api_key_here"
python app.py
```
**In Dockerfile:**
```dockerfile
ENV PIXELDRAIN_API_KEY="your_api_key_here"
```
### 3. Programmatically (Python)
```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:
- **View Files**: https://pixeldrain.com/user/files
- **Manage API Keys**: https://pixeldrain.com/user/api_keys
- **Account Settings**: https://pixeldrain.com/user/account
## 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:
```bash
# In Space Settings β Repository secrets
PIXELDRAIN_API_KEY = your_api_key_here
```
### Set in Local Terminal:
```bash
# 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:
```bash
# 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**
|