File size: 2,722 Bytes
0a512d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---

title: YouTube Automation Studio
emoji: 🎬
colorFrom: red
colorTo: blue
sdk: docker
pinned: false
license: mit
app_port: 7860
---


# 🎬 YouTube Automation Studio

AI-powered automation tool for downloading Instagram Reels, generating metadata with Google Gemini AI, and uploading to YouTube automatically.

## ✨ Features

- πŸ“₯ **Instagram Reel Downloader**: Download Reels in HD quality with original audio
- πŸ€– **AI Metadata Generator**: Generate SEO-optimized titles, descriptions, tags using Google Gemini 2.0
- πŸ“€ **YouTube Auto Uploader**: Upload directly to YouTube with automated metadata
- 🎡 **Video Editor**: Add background music and text overlays to videos
- πŸ” **Multi-User Support**: Each user has their own isolated YouTube authentication

## πŸš€ Quick Start

1. **Set Environment Variables** (Required):
   - `GEMINI_API_KEY`: Get from [Google AI Studio](https://makersuite.google.com/app/apikey)
   - `IG_SESSIONID`: Instagram session cookie (see below)
   - `SECRET_KEY`: Generate with `python -c "import secrets; print(secrets.token_hex(32))"`

2. **Upload client_secret.json**:

   - Create OAuth credentials in [Google Cloud Console](https://console.cloud.google.com)

   - Enable YouTube Data API v3

   - Download and upload `client_secret.json` as a secret file



3. **Access the app** and start automating!

## πŸ”‘ Getting Instagram Session ID

1. Open Instagram in Chrome
2. Press `F12` β†’ Application β†’ Cookies β†’ instagram.com
3. Find `sessionid` cookie and copy its value
4. Add to Space secrets as `IG_SESSIONID`

## 🎯 Usage

1. **Sign in with YouTube** (OAuth 2.0 - secure & one-time)
2. **Paste Instagram Reel URL**
3. **(Optional) Add video editing**:
   - Background music from YouTube or local file
   - Text overlays with custom positioning
4. **AI generates metadata** (title, description, tags, hashtags)
5. **Video uploads to YouTube** automatically

## πŸ› οΈ Tech Stack

- **Backend**: Flask, Python 3.11, Gunicorn
- **AI**: Google Gemini 2.0 Flash
- **APIs**: YouTube Data API v3, Instagram
- **Video Processing**: MoviePy, OpenCV, FFmpeg
- **Auth**: OAuth 2.0, Session-based authentication

## πŸ“‹ Environment Variables

Set these in your Hugging Face Space settings:

```env

ENVIRONMENT=production

GEMINI_API_KEY=your-gemini-api-key-here

IG_SESSIONID=your-instagram-sessionid-here

SECRET_KEY=your-secret-key-here

```

## πŸ”’ Security

- OAuth 2.0 for YouTube authentication
- Session-based user isolation
- Secure cookie handling
- No password storage
- Automatic credential refresh

## πŸ“ OAuth Redirect URI

Add this to your Google Cloud OAuth credentials:
````