Skip to content

Commit

Permalink
Handle JSONLD arrays (fixes #908) (#947)
Browse files Browse the repository at this point in the history
* Handle JSONLD arrays

* Fix prettier
  • Loading branch information
ysuhaas authored Jan 16, 2025
1 parent 8c0ff87 commit 118f015
Show file tree
Hide file tree
Showing 5 changed files with 1,904 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Readability.js
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,18 @@ Readability.prototype = {
);
var parsed = JSON.parse(content);

if (Array.isArray(parsed)) {
parsed = parsed.find(it => {
return (
it["@type"] &&
it["@type"].match(this.REGEXPS.jsonLdArticleTypes)
);
});
if (!parsed) {
return;
}
}

var schemaDotOrgRegex = /^https?\:\/\/schema\.org\/?$/;
var matches =
(typeof parsed["@context"] === "string" &&
Expand Down
4 changes: 2 additions & 2 deletions test/test-pages/article-author-tag/expected-metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"title": "If You Can Picture A Tarot Card, It's Because of These 3 People",
"title": "The Deck of Cards That Made Tarot A Global Phenomenon",
"byline": "Laura June Topolsky",
"dir": null,
"lang": "en",
"excerpt": "Picture a deck of tarot cards. What do you see? Maybe the Magician in his rich red robes, right arm raised high above him. Or the skeleton on horseback for...",
"siteName": "Atlas Obscura",
"publishedTime": "2015-07-10 09:53:00 -0400",
"publishedTime": "2015-07-10T09:53:00-04:00",
"readerable": true
}
10 changes: 10 additions & 0 deletions test/test-pages/spiceworks/expected-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Rewriting Rules of Engagement with Video in 2020: Vidyard Introduces New Features on its Video Platform",
"byline": "Last Updated: January 7, 2025",
"dir": null,
"lang": "en-US",
"excerpt": "Vidyard launches new tools and features on its platform to help professionals collaborate and share videos on the go.",
"siteName": "Spiceworks",
"publishedTime": "2020-07-10T14:15:42+00:00",
"readerable": true
}
24 changes: 24 additions & 0 deletions test/test-pages/spiceworks/expected.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div id="readability-page-1" class="page">
<div id="description">
<p><strong><em>Vidyard Launches New Tools and Features for Businesses</em></strong></p>
<p> Vidyard announced significant updates to its video hosting platform and tools yesterday. The company that provides video platforms for businesses <a href="https://www.vidyard.com/press-releases/vidyard-redesigns-video-hosting-platform-and-launches-new-tools/" title="Opens a new window" target="_blank">said<span>Opens a new window </span></a> that the new product lineup was introduced in response to brands’ rapidly increasing reliance on videos to reach and engage remote audiences. In light of COVID-19 and resulting changes in the way we work, live, and buy – videos are no longer just a marketing tool, they are critical for employee engagement, prospecting, and sales. </p>
<p> Key changes to Vidyard’s platform include new integration with Zoom, redesign of its video hosting platform, and enterprise video platform services. It is interesting to see that the company is offering business-grade video hosting, creation, sharing, and measurement capabilities for free to all users. </p>
<p> Learn More: <a href="https://www.spiceworks.com/marketing/content-marketing/guest-article/video-marketing-101-4-basics-marketers-cant-miss/">Video Marketing 101: 4 Basics Marketers Can’t Miss</a>
</p>
<p> “Businesses are quickly evolving their sales, marketing, and communications strategies to align with a digital-first communication world,” says Michael Litt, co-founder and CEO of Vidyard. “Video is a huge part of that as it’s simply more efficient, more expressive, and more effective than standard text. Today’s businesses need a simpler, smarter, and more scalable way to put the power of video into their people’s hands. We’re excited to deliver on that need with a new breed of video creation and hosting solutions that turn any business professional into a video creator and any organization into a video-first business.” </p>
<p> The company witnessed a 400&amp;percnt; increase in new monthly sign-ups of its online screen recording and <a href="https://www.spiceworks.com/marketing/marketing-strategy/articles/five-hot-video-marketing-tools-coming-soon/">video creation tool</a> since March 1, 2020. With this release, Vidyard has launched some innovative new features on its platform such as online video recording and sharing that allow users to create and collaborate on video creation. It has also introduced new mobile apps to enable marketers to create and share customer videos from anywhere or on the go. New launches include: </p>
<ul>
<li>Vidyard android app and Updated iOS app: These apps have been designed to help marketers and professionals record and share videos from anywhere. The apps allow users to quickly record videos while on the go and immediately share them through a company-branded video page. The mobile apps and the online video recording tool connect to the same video libraries, making it seamless for users to transition between desktop and mobile with continuous access to all video recordings. </li>
<li>Comments and reply features: Viewers can now leave a comment or reply to videos shared by professionals using Pro, Teams, Business, and Enterprise tier offerings. Video posters/sharers receive comment notifications to enable quicker replies – thereby turning any video into a collaboration tool. </li>
<li>Improved security features: Vidyard now offers users of Pro, Teams, and Business plans to secure viewer access to private videos through custom passwords. Customers can also use single sign-on (SSO) to ensure private videos created and shared by internal users can be viewed by other employees within the organization. </li>
<li>Revamped UX: Vidyard makes it easier for users to generate transcripts, add closed captions, customize video thumbnail, set viewing permissions, and publish content across public and private channels. The company says it has made it easier for beginner video creators to create professional-grade videos easily. </li>
</ul>
<p> Learn More: <a href="https://www.spiceworks.com/marketing/content-marketing/articles/seven-tips-for-repurposing-video-content/">Seven Tips for Repurposing Video Content</a>
</p>
<h2> Video is the Ultimate Engagement Tool for Marketers in 2020 </h2>
<p> With people confined to their homes for the last three to four months, our social lives have moved online, and video consumption has risen notably within the at-home segments of television, gaming, education, OTT, and business content. </p>
<p> Consumer behavior is rapidly evolving as the world adjusts to the new normal. The emergence of trends, such as social distancing, work-from-home, and virtual meetings have increased the demand for at-home digital media. </p>
<p> Video platforms like Vidyard are looking to accelerate consumer habit-formation through the ease of access and intuitive interfaces. What does this mean for marketers? It is no secret that videos are the most engaging tool available to marketers today. However, barriers such as video production, screen recording, and easy sharing had traditionally prevented marketers from unlocking the real potential of digital videos. </p>
<p> With the introduction of smart video platforms, marketers can leverage the format to not only engage customers and drive sales, but also share access with other business functions within the organization, like HR and finance, who can also use it as an employee-facing tool. </p>
</div>
</div>
Loading

0 comments on commit 118f015

Please sign in to comment.