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.
- 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. Save these credentials as they need to be passed to YouTube in the connection string when importing data into the ElastiCube Manager.
- Click OK.
- Select Library > YouTube Data API.
- Click Enable.
Sisense uses connection strings to connect to YouTube and import data into the ElastiCube Manager. Each connection string contains authentication parameters that the data source uses to verify your identity and what information you can export to Sisense.
Note: When switching accounts, you must sign out of your account and then sign it with the new account.
After you have obtained the relevant credentials, you can create the connection used to connect to your YouTube account. The YouTube connection string has the following structure:
The following is an example of a YouTube connection string:
The example above includes mandatory parameters you can provide in the connection. The required parameters are emphasized in bold.
- 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.
- OAuthClientSecret: Set this to the Client Secret.
- CallbackURL: Set this to http://localhost.
Alternatively, you can keep the OAuthClientId and the OAuthClientSecret parameters empty to redirect your users to the YouTube authentication page where they can log in to their accounts to access their tables without creating a YouTube app.
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.
Sisense uses connection strings to connect to YouTube and import data into the ElastiCube Manager. Each connection string contains a authentication parameters that the data source uses to verify your identity and what information you can export to Sisense.
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.
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.|
|18.104.22.168||June 20, 2017||Support added for retrieving all videos based on channel
SELECT * FROM Videos WHERE ChannelId IN (SELECT Id FROM Channels)|
Many of the tables have been updated to include additional inputs such as OnBehalfOfContentOwner (string) and ForContentOwner (boolean).
|22.214.171.124||March 16, 2017||PublishedAt column presented correctly|
Views are now more readable with important fields reordered and unnecessary fields removed
|126.96.36.199||January 16, 2017||General release|
Hey! Was this article helpful?
Questions? Ask the community.