Introduction
The OTT Syndication API is primarly intended to help OTT app creators to provide datasets needed by OTT platforms for universal search, but it is a flexible system that can be used for other syndication purposes. The templates provided below can be used as models for building templates you need.
Below is a sample template for generating a Google sitemap in XML.
{%- comment -%}
Google Video Sitemap (XML)
{%- endcomment -%}
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="https://www.google.com/schemas/sitemap-video/1.1">
{%- for asset in assets %}
{%- if asset.images.size > 0 and asset.images[0].thumbnail %}
{%- assign thumbnail = asset.images[0].thumbnail | xmlEscape %}
{%- endif %}
{%- assign title = asset.original_title | xmlEscape | truncate: 100 %}
{%- if asset.textual.size > 0 and asset.textual[0].description %}
{%- assign description = asset.textual[0].description | xmlEscape | truncate: 2048 %}
{%- endif %}
{%- comment %} Skip assets that don't have all required fields {%- endcomment %}
{%- unless thumbnail and title and description and asset.asset_id and locator_prefix %}
{%- continue %}
{%- endunless %}
{%- comment %} Use first valid filtered rights object {% endcomment %}
{%- assign bestRight = nil %}
{%- if asset.filtered_rights.size > 0 %}
{%- assign bestRight = asset.filtered_rights[0] %}
{%- endif %}
<url>
<loc>{{- locator_prefix | xmlEscape}}/details/{{asset.asset_id}}</loc>
<video:video>
<video:thumbnail_loc>{{thumbnail}}</video:thumbnail_loc>
<video:title>{{title}}</video:title>
<video:description>{{description}}</video:description>
<video:player_loc>{{locator_prefix | xmlEscape}}/player/{{asset.asset_id}}/stream</video:player_loc>
{%- if asset.length_full %}
<video:duration>{{asset.length_full | toSeconds}}</video:duration>
{%- endif %}
{%- if bestRight.end_date %}
<video:expiration_date>{{bestRight.end_date}}</video:expiration_date>
{%- endif %}
{%- comment %}Max of 32 tags{%- endcomment %}
{%- if asset.tags %}
{%- assign tagCount = 0 %}
{%- for tag in asset.tags %}
<video:tag>{{tag.name | xmlEscape}}</video:tag>
{%- assign tagCount = tagCount | plus: 1 %}
{%- if tagCount > 31 %}{% break %}{% endif %}
{%- endfor %}
{%- endif %}
{%- if bestRight.permitted_locations.size > 0 and bestRight.permitted_locations[0].name != "World" %}
{%- assign permittedLocNames = bestRight.permitted_locations | map: "name" %}
<video:restriction relationship="allow">{{permittedLocNames | join: " "}}</video:restriction>
{%- elsif bestRight.denied_locations.size > 0 %}
{%- assign deniedLocNames = bestRight.denied_locations | map: "name" %}
<video:restriction relationship="deny">{{deniedLocNames | join: " "}}</video:restriction>
{%- endif %}
{%- if bestRight.type == "SVOD" %}
<video:requires_subscription>yes</video:requires_subscription>
{%- endif %}
</video:video>
</url>
{%- endfor %}
</urlset>