Airtable Youtube Integration: 2 Easy Steps

on Airtable, Data Integration, Relational Database, Spreadsheet Application, Tutorials, YouTube, YouTube Analytics • November 19th, 2021 • Write for Hevo

airtable youtube: featured image

Airtable takes the best aspects of spreadsheets and databases and puts them together. Airtable can store information in a spreadsheet that’s visually appealing and easy-to-use, but it’s also powerful enough to act as a database that businesses can use for customer-relationship management (CRM), task management, project planning, and tracking inventory. Airtable Youtube Integration opens up a new world of analytical values to the content creators.

YouTube is a free video sharing website that makes it easy to watch online videos. You can even create and upload your own videos to share with others. Originally created in 2005, YouTube is now one of the most popular sites on the Web, with visitors watching around 6 billion hours of video every month.

This article provides a step-by-step guide on setting up Airtable Youtube Integration.

Table of Contents

What is Airtable?

Airtable is an incredibly flexible system that combines the functionality of a spreadsheet with the power of a database. An end result is a highly-customizable tool. Use Cases of Airtable are

  • Project management
  • Customer relationships management
  • Content calendars
  • Client booking

Airtable can be used to organize information and then display it in a variety of ways, from a simple spreadsheet-style layout to calendars, Kanban boards, and gallery views. 

The best part is that Airtable takes the hassle out of creating these tools. Getting advanced functionality out of a spreadsheet can be quite complex, but Airtable is designed to be simple and easy to use.

Basic Components of Airtable

Airtable is a combination of spreadsheets and databases; it’s the best of both worlds. Airtable makes it easier to interact with your data, while at the same time enabling programmatic management of your data. A few components of that Airtable consists is given below.

  • Bases are collections of Tables. Airtable has existing templates like Content Calendar, Project Tracker, Event planning, and more.
  • Workspace is a collection of Bases in Airtable. If bases are folders that hold Excel files, a workspace would be the hard drive that holds those folders.
  • Tables are where your data is stored. They are similar to spreadsheets. Tables have columns, rows, and fields (which we’ll get to in a minute).
  • Views are a powerful Airtable feature that allows you to configure how you view the data in a table.

Simplify Data Analysis with Hevo’s No-code Data Pipeline

Hevo Data, a No-code Data Pipeline helps to load data from any data source such as Databases, SaaS applications, Cloud Storage, SDKs, and Streaming Services and simplifies the ETL process. It supports 100+ data sources (including 30+ free data sources) like Asana and is a 3-step process by just selecting the data source, providing valid credentials, and choosing the destination. Hevo not only loads the data onto the desired Data Warehouse/destination but also enriches the data and transforms it into an analysis-ready form without having to write a single line of code.

GET STARTED WITH HEVO FOR FREE[/hevoButton]

Its completely automated pipeline offers data to be delivered in real-time without any loss from source to destination. Its fault-tolerant and scalable architecture ensure that the data is handled in a secure, consistent manner with zero data loss and supports different forms of data. The solutions provided are consistent and work with different BI tools as well.

Check out why Hevo is the Best:

  • Secure: Hevo has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Minimal Learning: Hevo, with its simple and interactive UI, is extremely simple for new customers to work on and perform operations.
  • Hevo Is Built To Scale: As the number of sources and the volume of your data grows, Hevo scales horizontally, handling millions of records per minute with very little latency.
  • Incremental Data Load: Hevo allows the transfer of data that has been modified in real-time. This ensures efficient utilization of bandwidth on both ends.
  • Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
  • Live Monitoring: Hevo allows you to monitor the data flow and check where your data is at a particular point in time.
SIGN UP HERE FOR A 14-DAY FREE TRIAL

What is Youtube?

YouTube is a website designed for sharing video. Millions of users around the world have created accounts on the site that allow them to upload videos that anyone can watch. Every minute of every day, more than 35 hours of video is uploaded to YouTube.

Key features of YouTube

  • Create an account to share videos up to 15 minutes long with your family and friends.
  • Use the YouTube edit facility to create a movie with music and other features.
  • Restrict who views your videos with YouTube’s privacy option.
  • Search the archive for your favourite clips.
  • Catch up with programmes you’ve missed via ‘channels’ like 4oD, Channel 4’s playback channel.
  • Comment on and rate movies you’ve watched.
  • Watch a full-length feature film on your computer.
  • Use YouTube’s caption and subtitle facilities, and take advantage of its 3D and high-definition capability.

Airtable Youtube Integration

Airtable youtube integration is a two-step process where the data is first exported from youtube and youtube analytics then this data is uploaded into Airtable.

Step 1: Export data from youtube

Data can be exported fromm youtube for Airtable Youtube Integration in two ways – using Youtube Analytics and Youtube reporting API.

1) Export data from YouTube Analytics

Data can be Exported from Youtube Analytics to check large sets of performance metrics on Airtable Youtube Integration. You can export data for Airtable Youtube Integration while looking at either a channel or a specific video. If you’re a Content Manager, you can also download reports for several channels. Downloaded reports are limited to 500 rows. Use the YouTube Reporting API to download more than 500 rows of data.

Steps to Export data for a channel or video

  1. Sign in to YouTube Studio.
  2. From the left menu, select Analytics.
  3. Find the report you’d like to download and click SEE MORE.
  4. Make any adjustments you’d like to the report.
  5. At the top, select Export current view.
  6. Choose your preferred file format.

Export data from YouTube APIs

You can also get data from the YouTube Analytics API and the YouTube Reporting API. The YouTube Analytics API allows both channel owners and Content Managers to download custom reports of their YouTube Analytics data for Airtable Youtube Integration. The YouTube Reporting API allows you to download entire data sets in bulk for Airtable Youtube Integration.

2) YouTube Reporting API – Data Model

The YouTube Reporting API supports predefined reports that contain a comprehensive set of YouTube Analytics data for a channel or content owner that can be used in Airtable Youtube Integration. These reports allow you to download the bulk data sets that you can query with the YouTube Analytics API or in the Analytics section of the Creator Studio.

Report fields in these reports are characterized as either dimensions or metrics:

  • Dimensions are common criteria that are used to aggregate data, such as the date on which an action occurred or the country where the users were located. In a report, each row of data has a unique combination of dimension values.
  • Metrics are individual measurements related to user activity, ad performance, or estimated revenue. User activity metrics include things like video view counts and ratings (likes and dislikes).

Steps to Retrieve YouTube Analytics reports

Step 1: Retrieve authorization credentials

All YouTube Reporting API requests must be authorized. The Authorization guide explains how to use the OAuth 2.0 protocol to retrieve authorization tokens.

YouTube Reporting API requests use the following authorization scopes:

Scopes
https://www.googleapis.com/auth/yt-analytics.readonlyView YouTube Analytics reports for your YouTube content. This scope provides access to user activity metrics, like view counts and rating counts.
https://www.googleapis.com/auth/yt-analytics-monetary.readonlyView YouTube Analytics monetary reports for your YouTube content. This scope provides access to user activity metrics and to estimated revenue and ad performance metrics.
Step 2: Identify the report to retrieve

Call the API’s reportTypes.list method to retrieve a list of reports that can be generated for the channel or content owner for Airtable Youtube Integration. The method returns a list of report IDs and names. Capture the id property value for the reports that you want to have generated. For example, the ID of the basic user activity report for channels is channel_basic_a1.

You can also find the report names in the documentation that defines supported channel reports and content owner reports for Airtable Youtube Integration.

Step 3: Create a reporting job

YouTube does not begin to generate your report until you create a reporting job for that report.

To create a reporting job for Airtable Youtube Integration, call the API’s jobs.create method. Set the following values in the request body:

  • Set the reportTypeId property’s value to the report ID that you retrieved in step 2.
  • Set the name property’s value to the name that you want to associate with the report.

The API response to the jobs.create method contains a Job resource, which specifies the ID that uniquely identifies the job. You can start retrieving the report within 48 hours of the time that the Airtable Youtube Integration job is created, and the first available report will be for the day that you scheduled the job.

Step 4: Retrieve the job ID

Call the jobs.list method to retrieve a list of scheduled jobs. The reportTypeId property in each returned Job resource identifies the type of report that that job generates. Your application needs the id property value from the same resource in the following step.

Step 5: Retrieve the report’s download URL

Call the jobs.reports.list method to retrieve a list of reports created for the Airtable Youtube Integration job. In the request, set the jobId parameter to the job ID of the report that you want to retrieve.

The API response contains a list of Report resources for that job. Each resource refers to a report that contains data for a unique 24-hour period. Note that YouTube does generate downloadable reports for days on which no data was available. Those reports contain a header row but do not contain additional data.

  • The resource’s startTime and endTime properties identify the time period that the report’s data covers.
  • The resource’s downloadUrl property identifies the URL from which the report can be fetched.
  • The resource’s createTime property specifies the date and time when the report was generated. Your application should store this value and use it to determine whether previously downloaded reports have changed.
Step 6: Download the report

You can reduce the bandwidth needed to download reports for Airtable Youtube Integration by enabling gzip compression on download requests. While your application will need additional CPU time to uncompress API responses, the benefit of consuming fewer network resources usually outweighs that cost.

To receive a gzip-encoded response, set the Accept-Encoding HTTP request header to gzip as shown in the following example:

Step 2: Import YouTube analytics

1) Enrich your table with metadata for your videos via the YouTube Data API

This script queries the YouTube Data API for video metadata (e.g. number of likes & views), then stores that data in the specified field for Airtable Youtube Integration.

To use this script, you will need a YouTube API key. You can create a new API key here.

let settings = input.config({
    title: "Import YouTube analytics",
    description: `This script queries the YouTube Data API for video metadata (e.g. number of likes & views), then
stores that data in the specified field.
To use this script, you will need a YouTube API key. You can [create a new API key here]
(https://developers.google.com/youtube/v3/getting-started). To learn more about the different properties you can query,
see [YouTube's documentation](https://developers.google.com/youtube/v3/docs/videos#resource-representation).`,
    items: [
        input.config.text("youtubeKey", {
            label: "YouTube Data API v3 key",
            description: "The API key will be visible to everyone who can view this base.",
        }),
        input.config.table("table", { label: "Table" }),
        input.config.field("videoField", {
            parentTable: "table",
            label: "Field containing YouTube video links",
        }),
        input.config.field("destinationField", {
            parentTable: "table",
            label: "Field in which to store the statistic",
        }),
        input.config.text("statistic", {
            label: "Video statistic",
            description:
                '(e.g. "snippet.thumbnails.default.url"). Learn more here: https://developers.google.com/youtube/v3/docs/videos#resource-representation',
        }),
    ],
});
let description = `
# Capture YouTube Analytics
For each record in a given table which contains a link to a video on YouTube.com, fetch some metadata describing the video and store the information in another field.
- [YouTube Data API
    Overview](https://developers.google.com/youtube/v3/getting-started) - for
    details on configuring a YouTube account and retrieving an API key
- [YouTube Video Resource
    Representation](https://developers.google.com/youtube/v3/docs/videos#resource-representation) -
    for details on the available data, including the valid options for "statistic
    name"
`;
/**
 * The maximum number of videos which can be queried in a single request to the
 * YouTube Data API.
 */
let maxYoutubeResults = 50;
/**
 * The maximum number of records that can be updated in a single invocation of
 * `table.updateRecordsAsync`.
 */
let maxAirtableWrites = 50;
/**
 * Extract the YouTube video identifier from a YouTube video URL
 *
 * @params {string} url
 *
 * @returns {string|null} - a YouTube video ID if one can be found; `null`
 *                          otherwise
 */
function parseId(url) {
    let host, searchParams;
    try {
        ({ host, searchParams } = new URL(url));
    } catch (_) {
        return null;
    }
    if (!/(^|.)youtube.com$/i.test(host)) {
        return null;
    }
    return searchParams.get("v") || null;
}
/**
 * Get a property value of an object, potentially nested within one or more
 * additional objects.
 *
 * @param {object} object - the value containing properties
 * @param {string} path - one or more property names separated by the period
 *                        character
 *
 * @returns {any} the value of the specified property
 */
function getPath(object, path) {
    let value = object;
    for (let propertyName of path.split(".")) {
        if (!(propertyName in value)) {
            throw new Error(`The property "${propertyName}" is not defined.`);
        }
        value = value[propertyName];
    }
    return value;
}
/**
 * Retrieve YouTube video metadata for one or more videos.
 *
 * @param {string} key - access key for the YouTube Data API
 * @param {object[]} items - one or more objects bearing a property named
 *                           `videoId`
 * @param {string} name - the name of a metadata statistic; statistics nested
 *                        within objects can be accessed using a period
 *                        character to separate property names
 *
 * @returns {Promise<object[]>} a copy of the input `items` array where each
 *                              element has been extended with a property named
 *                              `statistic`
 */
async function fetchVideoData(key, items, name) {
    let [part] = name.split(".", 1);
    let ids = items.map((item) => item.videoId);
    let urlString =
        "https://www.googleapis.com/youtube/v3/videos" +
        `?key=${key}&id=${ids.join(",")}&part=${part}`;
    let response = await fetch(urlString);
    if (!response.ok) {
        throw new Error(await response.text());
    }
    return (await response.json()).items.map((item, index) => ({
        ...items[index],
        statistic: JSON.stringify(getPath(item, name)),
    }));
}
output.markdown(description);
let { youtubeKey, table, videoField, destinationField, statistic } = settings;
let query = await table.selectRecordsAsync({ fields: [videoField.id] });
let bareItems = query.records
    .map((record) => ({
        record: record,
        videoId: parseId(record.getCellValueAsString(videoField.id)),
    }))
    .filter((item) => item.videoId);
let annotatedItems = [];
output.text(`Total number of records: ${query.records.length}`);
output.text(`Number of records with valid URLs: ${bareItems.length}`);
while (bareItems.length) {
    let workingSet = bareItems.splice(0, maxYoutubeResults);
    output.text(`Fetching statistics for ${workingSet.length} videos...`);
    annotatedItems.push(
        ...(await fetchVideoData(youtubeKey, workingSet, statistic))
    );
}
while (annotatedItems.length) {
    let workingSet = annotatedItems.splice(0, maxAirtableWrites);
    output.text(`Updating ${workingSet.length} records...`);
    let records = workingSet.map((item) => ({
        id: item.record.id,
        fields: {
            [destinationField.id]:
                // If the destination field is an attachment, assume the
                // statistic is a URL (e.g. a video preview image) and set the
                // value accordingly.
                destinationField.type === "multipleAttachments"
                    ? [{ url: item.statistic }]
                    : item.statistic,
        },
    }));
    await table.updateRecordsAsync(records);
}
output.text("Operation complete.");

2) Importing data from a CSV file

To import an existing spreadsheet or CSV, open the new base dialog by clicking the New Base icon:

Airtable youtube: bases
Image Source: support.airtable.com

Clicking this button will open a dialog with three options—click the option to Import a spreadsheet which is Airtable Youtube CSV.

This will open the “Import data” dialog.

IAirtable youtube: import data
Image Source: support.airtable.com

To import Airtable Youtube CSV file, just click the “CSV file” button.

Airtable youtube: import data csv
Image Source: support.airtable.com

Then, in the Choose a CSV file dialog, click the “Choose a .CSV file” button.

Airtable youtube: choose a csv
Image SOurce: support.airtable.com

From the attachment upload dialog, you can select Airtable Youtube CSV file from your computer that enables Airtable Youtube Integration. Note that there is currently a 5MB limit on CSV uploads.

Airtable youtube: file upload
Image Source: support.airtable.com

You can then choose to let Airtable try and detect the field types for Airtable Youtube Integration—or skip that step for now and set up the proper field types after your Airtable Youtube CSV is imported.

Airtable youtube: customise fields
Image Source: support.airtable.com

4) Importing data by pasting from a spreadsheet

In a spreadsheet application, select a range of cells and copy them using Ctrl + C.

Airtable youtube: copy data
Image Source: support.airtable.com

In the Import Data dialog, click the “Paste table data” button.

Airtable youtube: import data
Image Source: support.airtable.com

You can then paste that data into the text box in the Paste table data dialog using Ctrl + V.

Airtable youtube: paste table data
Image Source: support.airtable.com

3) Preview your pasted data

You will be shown a preview of the header cells that will be created in your new base based on the pasted data for Airtable Youtube Integration.

Airtable youtube: import pasted data
Image Source: support.airtable.com

If the first row in the pasted table is not a header, you can uncheck the “First record is a header” option, and every row pasted in will be added as records to the table.

6) Cleaning up the data

Once you’ve imported your Airtable Youtube CSV or pasted data, a new base will appear called Imported Base for Airtable Youtube Integration.

Airtable youtube: cleaning data
Image Source: support.airtable.com

After clicking into the Airtable Youtube Integration base, you’ll see a table comprised of single-line text fields. To get the most out of Airtable, we highly recommend that you take the time to convert fields from single line text fields to other field types, where appropriate

7) Converting text fields with commas

An important thing to note if you want to convert a field from a single line text field into a multiple select fields or linked record field is that Airtable will read commas as separators and create an appropriate number of select tokens/links based on the number of commas.

This means that if you wish to create a link to a record with a comma in its name, you will need to delimit the desired record name with quotation marks.

Conclusion

This article gives a comprehensive guide on Airtable and Youtube. It also gives a step-by-step guide on setting up Airtable Youtube Integration.

While Airtable Youtube Integration is insightful, it is a hectic task to Set Up the proper environment. To make things easier, Hevo comes into the picture. Hevo Data is a No-code Data Pipeline and has awesome 100+ pre-built Integrations that you can choose from.

visit our website to explore hevo[/hevoButton]

Hevo can help you Integrate your data from numerous sources like Airtable WordPress and load them into a destination to Analyze real-time data with a BI tool such as Tableau. It will make your life easier and data migration hassle-free. It is user-friendly, reliable, and secure.

SIGN UP for a 14-day free trial and see the difference!

Share your experience of learning about Airtable Youtube Integration in the comments section below.

No-code Data Pipeline For Your Data Warehouse