Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
shraddha-kesari committed Jul 17, 2024
1 parent 84d627c commit dfbbfb6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
8 changes: 4 additions & 4 deletions global.html
Original file line number Diff line number Diff line change
Expand Up @@ -1817,7 +1817,7 @@ <h5>Parameters:</h5>
<p class="tag-source">
<a href="src_structured-data_structured-data-tags.js.html" class="button">View Source</a>
<span>
<a href="src_structured-data_structured-data-tags.js.html">src/structured-data/structured-data-tags.js</a>, <a href="src_structured-data_structured-data-tags.js.html#line430">line 430</a>
<a href="src_structured-data_structured-data-tags.js.html">src/structured-data/structured-data-tags.js</a>, <a href="src_structured-data_structured-data-tags.js.html#line440">line 440</a>
</span>
</p>

Expand Down Expand Up @@ -2245,7 +2245,7 @@ <h4 class="name" id="Organization">
<p class="tag-source">
<a href="src_structured-data_structured-data-tags.js.html" class="button">View Source</a>
<span>
<a href="src_structured-data_structured-data-tags.js.html">src/structured-data/structured-data-tags.js</a>, <a href="src_structured-data_structured-data-tags.js.html#line366">line 366</a>
<a href="src_structured-data_structured-data-tags.js.html">src/structured-data/structured-data-tags.js</a>, <a href="src_structured-data_structured-data-tags.js.html#line376">line 376</a>
</span>
</p>

Expand Down Expand Up @@ -2629,7 +2629,7 @@ <h5 class="subsection-title">Properties:</h5>
<p class="tag-source">
<a href="src_structured-data_structured-data-tags.js.html" class="button">View Source</a>
<span>
<a href="src_structured-data_structured-data-tags.js.html">src/structured-data/structured-data-tags.js</a>, <a href="src_structured-data_structured-data-tags.js.html#line396">line 396</a>
<a href="src_structured-data_structured-data-tags.js.html">src/structured-data/structured-data-tags.js</a>, <a href="src_structured-data_structured-data-tags.js.html#line406">line 406</a>
</span>
</p>

Expand Down Expand Up @@ -2708,7 +2708,7 @@ <h4 class="name" id="Website">
<p class="tag-source">
<a href="src_structured-data_structured-data-tags.js.html" class="button">View Source</a>
<span>
<a href="src_structured-data_structured-data-tags.js.html">src/structured-data/structured-data-tags.js</a>, <a href="src_structured-data_structured-data-tags.js.html#line380">line 380</a>
<a href="src_structured-data_structured-data-tags.js.html">src/structured-data/structured-data-tags.js</a>, <a href="src_structured-data_structured-data-tags.js.html#line390">line 390</a>
</span>
</p>

Expand Down
36 changes: 23 additions & 13 deletions src_structured-data_structured-data-tags.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -358,23 +358,33 @@ <h1>src/structured-data/structured-data-tags.js</h1>
}

function getEmbedUrl(cards) {
let embedUrl = "";
const playerUrlMapping = {
"dailymotion-embed-script": "dailymotion-url",
"instagram": "instagram-url",
"facebook-video": "facebook-url",
"tweet": "tweet-url",
"vimeo-video": "vimeo-url",
"brightcove-video": "player-url"
};

// not using the return value of top level find
// coz we only need the embed url
// find is used for early exit
cards.find((card) => {
for (const card of cards) {
const storyElements = get(card, ["story-elements"], []);
return storyElements.find((elem) => {
if (elem["embed-url"]) {
embedUrl = elem["embed-url"];
return true;
for (const elem of storyElements) {
if (elem.subtype &amp;&amp; elem.subtype in playerUrlMapping) {
const playerUrlField = playerUrlMapping[elem.subtype];
if (elem.metadata &amp;&amp; elem.metadata[playerUrlField]) {
return elem.metadata[playerUrlField];
}
};
if (elem.type === "youtube-video" &amp;&amp; elem.subtype === null) {
if (elem.url) {
return elem.url;
}
}
return false;
});
});
}
}

return embedUrl;
return "";
}

function generateVideoArticleData(structuredData = {}, story = {}, publisherConfig = {}, timezone) {
Expand Down

0 comments on commit dfbbfb6

Please sign in to comment.