Capture fresh YouTube video stats and store them in PostgreSQL for clean reporting. Ideal for marketing and content teams that want a simple way to track performance and find top videos from the last two weeks without manual work.
The flow can run by hand or be called from another workflow. For each channel, it reads the latest publish time from the database, then pulls up to 50 newer videos from the YouTube API. It fetches detailed metrics like views, likes, comments, and duration, removes Shorts by checking video length, maps fields into a standard format, and writes rows in bulk to a video_statistics table. A ranking query highlights best performing videos from the last two weeks so teams can plan what to promote next.
You need a YouTube account with API access and a PostgreSQL database. Set the Google API key in n8n and connect YouTube OAuth and PostgreSQL credentials. Expect faster reporting, fewer errors, and consistent data you can plug into dashboards. Use it to monitor channels, measure new uploads, and spot winning content on a steady two week cycle.