Skip to content

Commit 2785ab0

Browse files
committed
Add exclude id to subtitle upload
1 parent 3868ba7 commit 2785ab0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

scripts/youtube/youtubeSubtitleUpload.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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...`)

0 commit comments

Comments
 (0)