// Fetch the record that triggered the automation
let inputConfig = input.config();
let recordId = inputConfig.recordId;
let table = base.getTable('Your Table Name');
let record = await table.selectRecordAsync(recordId);
let videoURL = record.getCellValue('Link Sample Video');
if (videoURL) {
let videoID = videoURL.split('v=')[1].split('&')[0];
let accessToken = 'YOUR_ACCESS_TOKEN'; // Replace with the actual access token
// API call to get the caption list
headers: {
'Authorization': `Bearer ${accessToken}`
}
});
let data = await response.json();
if (data.error) {
console.error('Error fetching transcript:', data.error);
return;
}
if (data.items && data.items.length > 0) {
let captionId = data.items[0].id;
// Call to get the actual transcript
headers: {
'Authorization': `Bearer ${accessToken}`
}
});
let transcriptData = await transcriptResponse.json();
if (transcriptData.error) {
console.error('Error fetching transcript:', transcriptData.error);
return;
}
// Process transcriptData to extract text and update Airtable
// ...
} else {
console.log('No captions available for this video.');
}
} else {
console.log('No video URL found in the record.');
}