Skip to content

Commit

Permalink
update test cases, add a couple of logs
Browse files Browse the repository at this point in the history
  • Loading branch information
inhumantsar committed Jun 11, 2024
1 parent ba0b0ee commit 30211ad
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
9 changes: 7 additions & 2 deletions Readability.js
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,8 @@ Readability.prototype = {
metadata.siteName = this._unescapeHtmlEntities(metadata.siteName);
metadata.publishedTime = this._unescapeHtmlEntities(metadata.publishedTime);

this.log("getArticleMetadata complete", metadata);

return metadata;
},

Expand Down Expand Up @@ -2352,7 +2354,7 @@ Readability.prototype = {
}

var textContent = articleContent.textContent;
return {
var parsedArticle = {
title: this._articleTitle,
byline: metadata.byline || this._articleByline,
dir: this._articleDir,
Expand All @@ -2364,7 +2366,10 @@ Readability.prototype = {
siteName: metadata.siteName || this._articleSiteName,
publishedTime: metadata.publishedTime,
};
},

this.log("parse complete", parsedArticle);
return parsedArticle;
}
};

if (typeof module === "object") {
Expand Down
4 changes: 0 additions & 4 deletions test/test-pages/cnet/expected.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,5 @@
<p>It wasn't clear why these strategies didn't work on Snapchat CEO Evan Spiegel, who <a href="https://www.cnet.com/news/snapchat-said-to-rebuff-3-billion-offer-from-facebook/">famously rebuffed</a> a $3 billion takeover offer from Facebook in 2013.</p>
<p><em><strong>Tech Enabled:</strong> CNET chronicles tech's role in providing new kinds of accessibility. Check it out <a href="https://www.cnet.com/tech-enabled/">here</a>.</em><em><strong><br /></strong></em></p>
<p><em><strong>Technically Literate:</strong> Original works of short fiction with unique perspectives on tech, exclusively on CNET. <a href="https://www.cnet.com/technically-literate/">Here</a>.</em></p>
<div id="taboola-zuckerberg-offers-peek-at-facebooks-acquisition-strategies-below-article-thumbnails-article-redesign" data-component="taboola" data-taboola-options="{&quot;mode&quot;:&quot;thumbnails-f&quot;,&quot;container&quot;:&quot;taboola-zuckerberg-offers-peek-at-facebooks-acquisition-strategies-below-article-thumbnails-article-redesign&quot;,&quot;canonicalUrl&quot;:&quot;https:\/\/www.cnet.com\/news\/zuckerberg-offers-peek-at-facebooks-acquisition-strategies\/&quot;,&quot;placement&quot;:&quot;Below Article Thumbnails Article Redesign&quot;,&quot;width&quot;:&quot;col-8&quot;,&quot;isXhr&quot;:false,&quot;target_type&quot;:&quot;mix&quot;}" data-placement-name="article desktop Below Article Thumbnails Article Redesign">
<p><span><span>YOU</span> MAY ALSO LIKE</span>
</p>
</div>
</div>
</div>
1 change: 1 addition & 0 deletions test/test-pages/engadget/expected.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ <h4>Engadget Score <div>
</div>
<div>
<div>
<h5>Pros</h5>
<ul>
<li>Most powerful hardware ever in a home console </li>
<li>Solid selection of enhanced titles </li>
Expand Down
2 changes: 1 addition & 1 deletion test/test-pages/herald-sun-1/expected-metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Angry media won’t buckle over new surveillance laws",
"byline": "JOE HILDEBRAND",
"byline": "by:\n\t\t\t\t\t\t\t\t\t\t Laurie Oakes",
"dir": null,
"lang": "en-au",
"excerpt": "A HIGH-powered federal government team has been doing the rounds of media organisations in the past few days in an attempt to allay concerns about the impact of new surveillance legislation on press freedom. It failed.",
Expand Down
3 changes: 0 additions & 3 deletions test/test-pages/nytimes-2/expected.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<main id="main" role="main">
<article id="story">
<header id="story-header">
<div id="story-meta">
<p><span>Supported by</span></p>
</div>
</header>
<div>
<figure id="media-100000004560166" data-media-action="modal" itemprop="associatedMedia" itemscope="" itemid="https://static01.nyt.com/images/2016/07/30/business/db-dealprof/db-dealprof-master315.jpg" itemtype="http://schema.org/ImageObject" aria-label="media" role="group">
Expand Down
1 change: 0 additions & 1 deletion test/test-pages/parsely-metadata/expected-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"title": "Some Other Title",
"byline": "Jane Doe",
"dir": null,
"lang": null,
"excerpt": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
"siteName": null,
"publishedTime": "2024-04-20T04:20:00.000Z",
Expand Down
2 changes: 1 addition & 1 deletion test/test-pages/simplyfound-1/expected-metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Raspberry Pi 3 - The credit card sized PC that cost only $35 - All-time bestselling computer in UK",
"byline": null,
"byline": "Joe Wee \n \n \n Monday, February 29, 2016 @ 11:10 PM UTC",
"dir": null,
"lang": "en",
"excerpt": "The Raspberry Pi Foundation started by a handful of volunteers in 2012 when they released the original Raspberry Pi 256MB Model B without knowing what to expect. In a short four-year period they have grown to over sixty full-time employees and ha...",
Expand Down

0 comments on commit 30211ad

Please sign in to comment.