BS YouTube Connector

The BS YouTube Connector allows synchronizing videos uploaded, modified, or deleted in the Contentserv DAM to YouTube. For each uploaded video, YouTube will generate a YouTube ID, which can be written back to an attribute of the video in the Contentserv DAM. In such a scenario YouTube will work as a kind of Content Delivery Network, that allows the streaming of your videos all over the world with a great performance and high availability.

Installation & Licensing

Follow the general instructions on installation and licensing to install, update and activate the alani and the alaniyoutube modules:

Setting up the Connector

YouTube provides a REST API that allows creating, updating and deleting videos. The connector uses this API to synchronize DAM videos in selected folders. All changes to these folders are processed using the BS Event Queue.

To set up the connector two settings are required:

  • Setting up the YouTube API Credentials

  • Setting up the event queue by creating and scheduling an Active Script with the type “BS Event Queue”

Setting up the YouTube API Credentials

The BS YouTube Connector stores the API credentials in the global Settings at System Preferences / Settings / BS / YouTube Connector:

The API requires an OAuth Client ID and Secret. Use the “Click here and create an OAuth Client ID” to get to the Google Cloud Console. If you do not yet have an account, create it.

If you do not yet have a project, click on “Create Project”:

Provide at least the Project Name and click “Create”:

The new project dashboard will be shown:

Then click on APIs & Services > OAuth consent screen:


Choose “External” or “Internal” and click “Create”:

Fill out the form to describe the App:

Scroll down to provide more information about the App domain:

Add test users during the testing phase:

In the next step add the YouTube API to the BS YouTube Connector project by clicking on APIs & Services > Library:

Search for “youtube“ and select the “YouTube Data API v3”:

Click “Enable” to activate this API:

Finally, go to APIs & Services > Credentials:

Click “Create Credentials > OAuth client ID”:

Choose “Web application” as type and add the URL


as “Authorized redirect URIs”. In this example we used:


Click “Create” and copy your credentials from the pop-up screen:

The Client ID and Secret have to be provided in the settings of the BS YouTube Connector:

Connecting the YouTube Connector with your YouTube Account

The OAuth concept defines, how a developer or app can access another user's account. To do this, the user has to declare, that she trusts the App through a consent process.

To start this process click in the YouTube Connector settings on “Click here to authenticate”:

Provide your email address with the YouTube account and choose the account or brand account:

Until the app is verified you can click on “Continue” if you trust the application (you can ):

Grant the connector to manage your YouTube account. It wil have to create and delete videos on your behalf:

Confirm your choice and click “Allow”:

Technically this actions stores an access token to the alaniyoutube/data/token.txt file along with a refresh token:

Once this is done, the connector can talk to your YouTube account.

Setting up the event queue

Navigate to the ActiveJobs area and create a new Active Script of type “BS Event Queue”:

Choose “MAM Files” as Event Type and select the “BS YouTube Connector”.

In the Event Filter, you can specify which kind of videos should be synchronized by filtering for

  • Object Selection through Folders or Favorites

  • Node Type Filter (of course only End Nodes = Files in the DAM are relevant)

  • Workflow State Filter (if you want to synchronize videos only when reaching certain workflow states)

If you want to store the YouTube IDs created for your videos back to the DAM asset you can create a DAM attribute of type simple text field or read-only text field and select it here as “YouTube ID Field”.

Also you can select the Privacy Status for your Video:


In our case we created this field here:

Along with this field, we also create a YouTube preview field to display a YouTube viewer directly with the DAM video asset. This is of course optional, but can be done with a placeholder type “YouTube Preview” that comes with the BS Skills package:

In our sample any DAM video then has these two attributes:

Running the Connector

Finally, you can run the connector.

First choose the required “Events from” date to make sure, to transfer all videos starting from a certain time. Feel free to set this some date back in 2000 to make sure, all videos are transferred intially.

When the “Events from update” checkbox is activated, the script will automatically update the “Events from” after each successful run.

Note: This new date becomes only visible when you reload the Active Script.

In the Active Script Log, you can see, that the videos are uploaded. Click on a video to review the updated YouTube ID field and preview:

The videos are also available in your YouTube account:

Deleting YouTube Videos

When the DAM video asset is deleted, the connector will also delete the YouTube video the next time the event queue script is running.