The Sisense YouTube connector is a standalone connector that allows you to import data from the YouTube API into the ElastiCube Manager. After you have downloaded and installed the connector, you can connect to the YouTube API through a connection string you provide Sisense in the ElastiCube Manager. The connection string is used to authenticate users who connect to YouTube’s API. To obtain a connection string, you will need to create a YouTube app.
Once you have connected to YouTube, you can import a variety of tables from the YouTube API.
This page describes how to install the YouTube connector, how to connect to YouTube with a connection string, and what tables you can import into the ElastiCube Manager:
- Installing the YouTube Connector
- Connecting to the YouTube REST API
- Adding YouTube Tables to your ElastiCube
- YouTube Tables
Sisense provides the YouTube connector as a standalone connector that you can download and add to your list of default Sisense connectors.
To install the YouTube connector:
- Download the YouTube installation file.
- Open the installation file and click Install.
- After the installation process is complete, click Close.
The YouTube connector is displayed in the ElastiCube Manager under Add Data > Web Services.
To access YouTube’s REST API from the ElastiCube Manager, you must provide valid Oauth YouTube credentials through a connection string. These credentials are provided by YouTube when you create an application.
After you receive your credentials from YouTube, you can create the connection string and provide Sisense with it to connect to your data.
Creating an App
You can follow the procedure below to register an app and obtain the OAuth client credentials, the OAuthClientId and OAuthClientSecret:
- Log in to the Google Developers Console.
- Click Create Project or select an existing project.
- In the API Manager, click Credentials > Create Credentials > OAuth Client Id and then click Configure Consent Screen to customize the information displayed to users when they connect.
- If you are connecting from a desktop application, click Other in the Application Type section.If you are connecting from a Web application, click the Web Application option. In the Authorized Redirect URIs box, enter the URL you want to be used as a trusted redirect URL, where the user will return with the token that verifies that they have granted your app access.
- Click Create. The OAuthClientId and OAuthClientSecret are displayed.
- Click Library and enable the YouTube Data API.
Authenticate to YouTube
After setting the following connection properties, you are ready to connect:
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
- OAuthClientId: Set this to the Client Id in your app settings.
- OAuthClientSecret: Set this to the Client Secret in your app settings.
- CallbackURL: Set this to http://localhost.
When you connect the driver opens the OAuth endpoint in your default browser. Log in and grant permissions to the application. The driver then completes the OAuth process:
- Extracts the access token from the callback URL and authenticates requests.
- Refreshes the access token when it expires.
- Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
Sisense uses connection strings to connect to YouTube and import data into the ElastiCube Manager.
The connection string to connect to YouTube has the following structure:
Note: To switch between accounts, you need to delete the file OAuthsettings.txt file located at …\Users\xxx\AppData\Roaming\CData\Facebook Data Provider.
Below is an example of a connection string:
Note: To switch between accounts, you need to delete the file OAuthsettings.txt file located at …\Users\xxx\AppData\Roaming\CData\Youtube Data Provider.
To add YouTube data:
- In ElastiCube Manager, click Add Data and then, YouTube. The Connect to YouTube window is displayed.
- In Datasource Connection String, enter your connection string.
- Click Connect to Server. YouTube is displayed in the Select Database list.
- Click OK. Sisense connects to YouTube and displays a list of tables available for you to import.
- Select the relevant tables and click Add.
The tables are displayed in the ElastiCube Manager.
Switching between Accounts
When you connect to the YouTube data source, Sisense saves your OAuth values in the file OAuthsettings.txt file located at …\Users\xxx\AppData\Roaming\CData\YouTube Data Provider on your Sisense server. To connect to the YouTube data source with another user on the same machine, you must delete the OAuthsettings.txt file. Sisense will then generate a new file for that user.
Another option to support multiple users is to define the location and file name of an OAuthsettings file for each unique user in your connection string through the OAuthSettingsLocation parameter. When each user connects to the data source, Sisense generates the OAuth file with the file name you specify in the location you define. In the examples below, two users are allowed to access the YouTube data source and for each user, Sisense generates a file that contains that user’s OAuth values in the location defined in the string.
In the example above, to OAuth files are created, one for John and one for Sally in the location C:\YouTube\auth\.
This is useful if you support many users who each need to access the YouTube data source.
The Sisense YouTube connector allows you to import the following tables into the ElastiCube Manager.
|Activities||Query YouTube Activities. An Activity resource contains information about an action that a particular Channel, or User, has taken on YouTube.|
|Captions||Query YouTube Captions. A Caption resource represents a YouTube caption track.|
|Channels||Query YouTube Channels.|
|ChannelSections||Query YouTube ChannelSections. A ChannelSection contains information about a set of videos that a channel has chosen to feature.|
|Comments||Query YouTube Comments.|
|CommentThreads||Query YouTube CommentThreads. A CommentThread record contains information about a YouTube comment thread, a top-level comment and replies, if any exist, to that comment.|
|GuideCategories||Query YouTube GuideCategories. A GuideCategory resource identifies a category that YouTube algorithmically assigns based on a content of a channel or other indicators, such as the popularity of the channel.|
|Languages||Query YouTube i18nLanguages. An i18nLanguage resource identifies an application language that the YouTube website supports. The application language can also be referred to as a UI language.|
|PlayListItems||Query YouTube PlayListItems. A PlayListItem resource identifies another YouTube entity, such as a Video, that is included in a PlayList. In addition, the PlayListItem record contains details about how that entity is used in that PlayList.|
|PlayLists||Query YouTube PlayLists. A PlayList is a collection of videos that can be viewed sequentially and shared with other users.|
|Regions||Query YouTube i18nRegions. An i18nRegion resource identifies a geographic area that a YouTube user can select as the preferred content region. The content region can also be referred to as a content locale.|
|Subscriptions||Query YouTube User Subscriptions. A Subscription notifies a User when new Videos are added to a Channel, or when another user takes one of several actions on YouTube, such as uploading a Video, rating a Video, or commenting on a Video.|
|VideoAbuseReportReasons||Query YouTube VideoAbuseReportReasons. A VideoAbuseReportReason resource contains information about a reason that a Video would be flagged for containing abusive content.|
|VideoCategories||Query YouTube VideoCategories. A VideoCategory resource identifies a category that has been or could be associated with uploaded Videos.|
|Videos||Query YouTube Videos.|
Hey! Was this article helpful?
Questions? Ask the community.