YouTube Video Analysis and Database Storage Workflow

somdn_product_page

This n8n workflow automates the process of fetching, analyzing, and storing data about YouTube videos for specific channels. The purpose is to identify high-performing videos based on views, likes, and comments within the last two weeks and save the insights into a PostgreSQL database for further analysis or reporting.

The workflow begins by looping over a list of YouTube channels. For each channel, it fetches the latest videos posted after the last recorded publication date or within the last three months if no previous data exists. It filters out short videos, keeping only those longer than 3.5 minutes. This is achieved through a custom code node that removes shorts by analyzing ISO 8601 duration strings.

Subsequently, the workflow checks the database for the most recent publish time for each channel to fetch only new videos. It then structures the video data, ensuring the correct format and populating missing values with defaults.

Once the videos are processed, it filters for the best performers—videos published in the last two weeks with view counts exceeding twice the channel’s average. It calculates a performance score based on likes relative to views. The highly engaging videos are then prepared for insertion into a PostgreSQL database, where their details are stored for future reference.

Additionally, the workflow includes commands to create and drop the database table as necessary. It allows for repeated runs to keep data continually updated, making it highly suitable for content creators, marketers, or analytics teams wanting to monitor video performance over time.

This automation simplifies tracking YouTube metrics, enabling data-driven decisions about content strategy and audience engagement.

Node Count

>20 Nodes

Nodes Used

code, executeWorkflowTrigger, httpRequest, if, manualTrigger, postgres, set, splitInBatches, stickyNote, youTube

Reviews

There are no reviews yet.

Be the first to review “YouTube Video Analysis and Database Storage Workflow”

Your email address will not be published. Required fields are marked *