Youtube Searcher

This workflow can automatically extract the most recently released video data from a specified YouTube channel, filter out short videos, and select high-performing long videos from the past two weeks while calculating the like rate. After organizing the data, the high-quality video information will be stored in a PostgreSQL database, supporting subsequent data analysis and operational decision-making. This will help content creators and data analysts monitor video performance in real-time and optimize content strategies.

Workflow Diagram
Youtube Searcher Workflow diagram

Workflow Name

Youtube Searcher

Key Features and Highlights

This workflow automatically retrieves the latest video data from specified YouTube channels, filters out short videos (Shorts) with durations under 3 minutes 30 seconds, and selects high-performing videos from the past two weeks (with views at least twice the channel’s average). It also calculates the videos’ like ratios and stores the curated premium video data in a PostgreSQL database to support subsequent data analysis and operational decision-making.

Core Problems Addressed

  • Automates the acquisition and updating of YouTube channel video statistics, eliminating the need for manual data scraping and organization.
  • Intelligently filters out short videos to ensure analysis focuses on substantial long-form content.
  • Accurately identifies recently outstanding videos to help content operators quickly pinpoint trending content.
  • Structures video data storage to facilitate easy querying and data mining later.

Use Cases

  • Content creators and video operation teams for real-time monitoring of channel video performance.
  • Data analysts conducting trend analysis on YouTube video performance.
  • Media research organizations tracking video content dissemination effectiveness.
  • Marketing professionals evaluating video promotion results and selecting viral video materials.

Main Workflow Steps

  1. Trigger Execution: Start the workflow manually or via an execution trigger.
  2. Database Initialization: Create or prepare the video statistics table (video_statistics).
  3. Channel Video Query: Iterate over the input list of YouTube channel IDs.
  4. Retrieve Latest Stored Video Publish Time: Query the database to determine the newest video publish time per channel.
  5. Call YouTube Official API: Fetch the list of new videos published after the latest stored time, limited to 50 entries per channel.
  6. Filter Short Videos: Use a code node to exclude videos shorter than 3 minutes 30 seconds.
  7. Check for Existing Video Data: Avoid duplicate data insertion.
  8. Fetch Detailed Video Statistics: Call YouTube API to obtain detailed metrics such as view count, like count, and comment count.
  9. Data Formatting and Mapping: Standardize video data and fill in missing fields.
  10. Construct SQL Insert Statements: Dynamically generate batch insert SQL commands.
  11. Write Data to Database: Save video data into the PostgreSQL database.
  12. Identify Premium Videos: Based on the channel’s average view count, filter videos from the last two weeks with outstanding views and calculate like ratio scores.
  13. Output Premium Video List: Provide data for subsequent display or analysis.

Involved Systems or Services

  • YouTube API: For retrieving video lists and detailed statistics.
  • PostgreSQL Database: For storing and managing video statistics data.
  • n8n Nodes: Including HTTP requests, code processing, database operations, conditional logic, and batch loops to build a complete automated workflow.

Target Users and Value

  • Video Content Creators and Channel Managers: Quickly discover viral videos within their channels to optimize content strategies.
  • Data Analysts and Market Researchers: Easily access structured video performance data for informed analysis.
  • Digital Marketers: Use data-driven insights to select higher-quality videos for promotion.
  • Automation Enthusiasts and Technical Teams: Demonstrate how to leverage n8n to build complex data scraping and processing workflows, achieving cross-platform data automation integration.

The “Youtube Searcher” workflow efficiently integrates YouTube data retrieval with database storage, greatly simplifying the process of video data collection and analysis. It serves as a vital tool for enhancing the intelligence and effectiveness of video content operations.