Fetch YouTube video metadata and insert it into each row in a given table.
This script queries the YouTube Data API for video metadata. It stores the data in a user-specified field. Requests to the YouTube API and to the Airtable base are both batched for efficiency.
Notes on adapting this script.
Inspired by a user-created Airtable screencast:
This is pretty awesome. Thanks for this.
I’m curious what would need to be edited in order to “skip” videos that already have the particular stat set. For example, if I have an ever-growing list of video url’s that are being added to a particular field from a form, I don’t want to pull the title for every video, only the ones that don’t have the title populated yet.
Hello, thank you for this script. It seems though as of August 2021 this script is generating an error: J: Error: Failed schema validation: must be a number
at main on line 178
If I convert the item.statistic for the view count to a Number the error goes away, but I get a 0 count for all videos. Is there a workaround or fix for this?
Been cleaning up some workspaces just now and found a base in which I gave this script a spin last year. It still works fine, @Young_Kim1, can you link to some of those videos you were querying, assuming it’s still an issue?
Because the combination of that error and your description makes me think some of the channels you’re tracking delisted their original videos or made them private, possibly so as to republish them. Or some of those videos got banned/removed. Either way, definitely not a script issue any maybe not even a problem on your end, if it persists, share some of the problematic URLs next time as that would be the first suspect to look into here.
EDIT: Oh, and how much did you change the original script? 0 is synonymous with the concept of falsyness in JS, so generally not a good number to be testing anything with. I’d sonner try 1 - 10 - 100 hah.