File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ const main = async () => {
1616 const openPlannerEventId = process . env . OPENPLANNER_EVENT_ID
1717 const outSrtDir = './out_srt'
1818
19+ // Video IDs to skip (e.g. already uploaded), passed as CLI args:
20+ // node youtube/youtubeSubtitleUpload.js <videoId1> <videoId2> ...
21+ const excludeIds = new Set ( process . argv . slice ( 2 ) )
22+ if ( excludeIds . size > 0 ) {
23+ console . log ( `ℹ️ Excluding ${ excludeIds . size } already-uploaded video(s)` )
24+ }
25+
1926 const openPlannerContent = await getOpenPlannerContent ( openPlannerEventId )
2027
2128 const videos = await getVideosFromPlaylist ( auth , channelId , playlistId )
@@ -27,6 +34,11 @@ const main = async () => {
2734 const videoId = video . contentDetails . videoId
2835 const srtFilename = path . join ( outSrtDir , `${ videoId } .srt` )
2936
37+ if ( excludeIds . has ( videoId ) ) {
38+ console . log ( `⏭️ Skipping excluded video ID: ${ videoId } ` )
39+ continue
40+ }
41+
3042 const srtExists = fs . existsSync ( srtFilename )
3143 if ( ! srtExists ) {
3244 console . log ( `ℹ️ SRT file does not exist for video ID: ${ videoId } , skipping upload...` )
You can’t perform that action at this time.
0 commit comments