Skip to content

Commit 30211ad

Browse files
committed
update test cases, add a couple of logs
1 parent ba0b0ee commit 30211ad

7 files changed

Lines changed: 10 additions & 12 deletions

File tree

Readability.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,8 @@ Readability.prototype = {
15631563
metadata.siteName = this._unescapeHtmlEntities(metadata.siteName);
15641564
metadata.publishedTime = this._unescapeHtmlEntities(metadata.publishedTime);
15651565

1566+
this.log("getArticleMetadata complete", metadata);
1567+
15661568
return metadata;
15671569
},
15681570

@@ -2352,7 +2354,7 @@ Readability.prototype = {
23522354
}
23532355

23542356
var textContent = articleContent.textContent;
2355-
return {
2357+
var parsedArticle = {
23562358
title: this._articleTitle,
23572359
byline: metadata.byline || this._articleByline,
23582360
dir: this._articleDir,
@@ -2364,7 +2366,10 @@ Readability.prototype = {
23642366
siteName: metadata.siteName || this._articleSiteName,
23652367
publishedTime: metadata.publishedTime,
23662368
};
2367-
},
2369+
2370+
this.log("parse complete", parsedArticle);
2371+
return parsedArticle;
2372+
}
23682373
};
23692374

23702375
if (typeof module === "object") {

test/test-pages/cnet/expected.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,5 @@
2525
<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>
2626
<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>
2727
<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>
28-
<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">
29-
<p><span><span>YOU</span> MAY ALSO LIKE</span>
30-
</p>
31-
</div>
3228
</div>
3329
</div>

test/test-pages/engadget/expected.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ <h4>Engadget Score <div>
4040
</div>
4141
<div>
4242
<div>
43+
<h5>Pros</h5>
4344
<ul>
4445
<li>Most powerful hardware ever in a home console </li>
4546
<li>Solid selection of enhanced titles </li>

test/test-pages/herald-sun-1/expected-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "Angry media won’t buckle over new surveillance laws",
3-
"byline": "JOE HILDEBRAND",
3+
"byline": "by:\n\t\t\t\t\t\t\t\t\t\t Laurie Oakes",
44
"dir": null,
55
"lang": "en-au",
66
"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.",

test/test-pages/nytimes-2/expected.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
<main id="main" role="main">
44
<article id="story">
55
<header id="story-header">
6-
<div id="story-meta">
7-
<p><span>Supported by</span></p>
8-
</div>
96
</header>
107
<div>
118
<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">

test/test-pages/parsely-metadata/expected-metadata.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"title": "Some Other Title",
33
"byline": "Jane Doe",
44
"dir": null,
5-
"lang": null,
65
"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.",
76
"siteName": null,
87
"publishedTime": "2024-04-20T04:20:00.000Z",

test/test-pages/simplyfound-1/expected-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "Raspberry Pi 3 - The credit card sized PC that cost only $35 - All-time bestselling computer in UK",
3-
"byline": null,
3+
"byline": "Joe Wee \n \n \n Monday, February 29, 2016 @ 11:10 PM UTC",
44
"dir": null,
55
"lang": "en",
66
"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...",

0 commit comments

Comments
 (0)