@@ -30,21 +30,22 @@ rust-yt-uploader = "0.2.8"
3030#### Prerequisites
3131
3232- A Google Cloud project with YouTube Data API v3 enabled
33- - OAuth 2.0 client credentials ( ` client_secret.json ` )
33+ - OAuth 2.0 client credentials
3434
35351 . Go to the [ Google Cloud Console] ( https://console.cloud.google.com/ )
36362 . Create a new project or select an existing one
37373 . Enable the YouTube Data API v3
38384 . Create OAuth 2.0 credentials (Desktop application)
39- 5 . Download the credentials as ` client_secret.json `
40- 6 . Place the file in the parent directory of the Rust project
39+ 5 . Download the credentials and save as ` client_secret-{profile} .json ` (e.g., ` client_secret-work.json ` )
40+ 6 . Place the file in the working directory
4141
42- The first time you run the uploader, it will:
42+ The first time you run the uploader with a profile , it will:
4343
44- 1 . Display an authorization URL
45- 2 . Open your browser for authentication
46- 3 . Ask you to paste the authorization code
47- 4 . Save the tokens to ` youtube-oauth2.json `
44+ 1 . Load credentials from ` client_secret-{profile}.json `
45+ 2 . Display an authorization URL
46+ 3 . Open your browser for authentication
47+ 4 . Ask you to paste the authorization code
48+ 5 . Save the tokens to ` youtube-oauth2-{profile}.json `
4849
4950#### Build from Source
5051
@@ -70,11 +71,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
7071 // Load configuration
7172 let config = BatchConfigRoot :: from_file (" config.yaml" )? ;
7273
73- // Create authenticated client
74- let client = YouTubeClient :: new (
75- " client_secret.json" ,
76- " youtube-oauth2.json"
77- ). await ? ;
74+ // Create authenticated client with profile
75+ // Credentials: client_secret-work.json
76+ // Token: youtube-oauth2-work.json
77+ let client = YouTubeClient :: new (" work" ). await ? ;
7878
7979 // Upload videos
8080 client . upload_batch (& config ). await ? ;
@@ -89,14 +89,15 @@ For more advanced use cases requiring direct API access:
8989
9090``` rust
9191use rust_yt_uploader :: google_oauth :: {GoogleOAuth , Credentials };
92- use rust_yt_uploader :: youtube_client;
92+ use rust_yt_uploader :: { youtube_client, credentials_path_for_profile, token_path_for_profile} ;
9393
9494#[tokio:: main]
9595async fn main () -> Result <(), Box <dyn std :: error :: Error >> {
96- // Create OAuth client with custom scopes
96+ // Create OAuth client with profile-based paths
97+ let profile = " work" ;
9798 let oauth_client = GoogleOAuth :: new (
98- " client_secret.json" ,
99- " youtube-oauth2.json" ,
99+ credentials_path_for_profile ( profile ) ? , // client_secret-work .json
100+ token_path_for_profile ( profile ) ? , // youtube-oauth2-work .json
100101 youtube_client :: default_youtube_scopes (),
101102 youtube_client :: build_youtube_base_url (),
102103 ). await ? ;
@@ -190,17 +191,17 @@ Example: `PL1234567890123456`
190191# ### yt-upload: Upload Videos
191192
192193` ` ` bash
193- # Sequential upload (default )
194- yt-upload --file config.yaml
194+ # Sequential upload with profile (required )
195+ yt-upload --file config.yaml --profile work
195196
196197# Sequential upload with progress bars
197- yt-upload --file config.yaml --progress
198+ yt-upload --file config.yaml --profile work -- progress
198199
199200# Concurrent upload (3 concurrent by default)
200- yt-upload --file config.yaml --async
201+ yt-upload --file config.yaml --profile work -- async
201202
202203# Custom concurrency level
203- yt-upload --file config.yaml --async --concurrent 5
204+ yt-upload --file config.yaml --profile work -- async --concurrent 5
204205` ` `
205206
206207# ### yt-list: List and Export Videos
@@ -213,25 +214,20 @@ The `yt-list` tool lists all videos from your YouTube channel with comprehensive
213214**Basic Usage:**
214215
215216` ` ` bash
216- # List all videos in table format (default)
217- yt-list
217+ # List all videos in table format (default) - profile required
218+ yt-list --profile work
218219
219220# Export as JSON (for programmatic access)
220- yt-list --format json
221+ yt-list --profile work -- format json
221222
222223# Export as JSONL (one video per line, useful for piping)
223- yt-list --format jsonl
224+ yt-list --profile work -- format jsonl
224225
225226# Save to file instead of stdout
226- yt-list --format json --output videos.json
227+ yt-list --profile work -- format json --output videos.json
227228
228229# Show only video IDs (one per line)
229- yt-list --ids-only
230-
231- # Filter by privacy status
232- yt-list --status private
233- yt-list --status public
234- yt-list --status unlisted
230+ yt-list --profile work --ids-only
235231` ` `
236232
237233**Output Formats:**
@@ -258,14 +254,14 @@ Each video includes:
258254**Examples:**
259255
260256` ` ` bash
261- # Export public videos to JSON and pipe to jq for further processing
262- yt-list --format json --status public | jq '.[].id'
257+ # Export videos to JSON and pipe to jq for further processing
258+ yt-list --profile work --format json | jq '.[].id'
263259
264260# Extract video IDs and titles for batch download
265- yt-list --format jsonl | jq -r '[.id, .title] | join(": ")'
261+ yt-list --profile work -- format jsonl | jq -r '[.id, .title] | join(": ")'
266262
267263# Save all video metadata for backup
268- yt-list --format json --output my_videos_backup.json
264+ yt-list --profile work -- format json --output my_videos_backup.json
269265` ` `
270266
271267# ### yt-update-lang: Update Language Metadata
@@ -280,17 +276,17 @@ For any videos that don't already have these values set.
280276**Basic Usage:**
281277
282278` ` ` bash
283- # Show what would be updated (dry run)
284- yt-update-lang --dry-run
279+ # Show what would be updated (dry run) - profile required
280+ yt-update-lang --profile work -- dry-run
285281
286282# Update all public videos with language metadata
287- yt-update-lang
283+ yt-update-lang --profile work
288284
289285# Verbose mode - show each video being processed
290- yt-update-lang --verbose
286+ yt-update-lang --profile work -- verbose
291287
292288# Only update videos with no language metadata at all
293- yt-update-lang --only-empty
289+ yt-update-lang --profile work -- only-empty
294290` ` `
295291
296292**Features:**
@@ -305,16 +301,16 @@ yt-update-lang --only-empty
305301
306302` ` ` bash
307303# Preview changes before applying
308- yt-update-lang --dry-run
304+ yt-update-lang --profile work -- dry-run
309305
310306# Update with verbose output to see what's happening
311- yt-update-lang --verbose
307+ yt-update-lang --profile work -- verbose
312308
313309# Combine with yt-list to verify your videos first
314- yt-list --status public --format json | jq '.[] | {id, title, default_language, default_audio_language}'
310+ yt-list --profile work --format json | jq '.[] | {id, title, default_language, default_audio_language}'
315311
316312# Then update them
317- yt-update-lang
313+ yt-update-lang --profile work
318314` ` `
319315
320316**Use Cases:**
@@ -336,7 +332,7 @@ yt-update-lang
336332
337333# ## Security Notes
338334
339- - Never commit `client_secret.json` or token files to version control
335+ - Never commit `client_secret-{profile} .json` or `youtube-oauth2-{profile}.json` files to version control
340336- Store credentials securely with appropriate file permissions (600)
341337- Regularly rotate OAuth tokens if needed
342338- Use private/unlisted privacy settings for sensitive content
0 commit comments