YouTube
In this section, we present how to connect YouTube to MindsDB.
YouTube is a popular online video-sharing platform and social media website where users can upload, view, share, and interact with videos created by individuals and organizations from around the world.
Prerequisites
Before proceeding, ensure the following prerequisites are met:
- Install MindsDB on your system or obtain access to cloud options.
- To use YouTube with MindsDB, install the required dependencies following this instruction.
Connection
There are two ways you can connect YouTube to MindsDB:
- Limited permissions: This option provides MindsDB with read-only access to YouTube, including viewing comments data.
- Elevated permissions: This option provides MindsDB with full access to YouTube, including viewing comments data and posting replies to comments.
Option 1: Limited permissions
Establish a connection to YouTube from MindsDB by executing the below SQL command and following the Google authorization link provided as output:
Alternatively, you can connect YouTube to MindsDB via the form.
To do that, click on the Add
button, choose New Datasource
, search for YouTube
, and follow the instructions in the form. After providing the connection name and the YouTube API token, click on the Test Connection
button. Once the connection is established, click on the Save and Continue
button.
Required connection parameters include the following:
youtube_api_token
: It is a Google API key used for authentication. Check out this guide on how to create the API key to access YouTube data.
Option 2: Elevated permissions
Establish a connection to YouTube from MindsDB by executing the below SQL command and following the Google authorization link provided as output:
Alternatively, you can connect YouTube to MindsDB via the form.
To do that, click on the Add
button, choose New Datasource
, search for YouTube
, and follow the instructions in the form. After providing the connection name and the credentials file or URL, click on the Test Connection
button and complete the authorization process in the pop-up window. Once the connection is established, click on the Save and Continue
button.
Required connection parameters include one of the following:
credentials_file
: It is a path to a file generated from the Google Cloud Console, as described below.credentials_url
: It is a URL to a file generated from the Google Cloud Console, as described below.
Usage
Use the established connection to query the comments
table.
You can query for one video’s comments:
Or for one channels’s comments:
You can include ordering and limiting the output data:
Use the established connection to query the channels
table.
Here, the channel_id
column is mandatory in the WHERE
clause.
Use the established connection to query the videos
table.
Here, the video_id
column is mandatory in the WHERE
clause.
With the connection option 2, you can insert replies to comments:
Was this page helpful?