forked from microlinkhq/metascraper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: provide parsed JSON-LD to rules * feat: implement JSON-LD retrieval of date * feat: implement JSON-LD retrieval of title * feat: implement JSON-LD retrieval of publisher * feat: implement JSON-LD retrieval of description * feat: implement JSON-LD retrieval of image * feat: implement JSON-LD retrieval of lang * feat: add support for <meta itemprop="inLanguage"> * refactor: extract jsonld as helper * build: sort order * build: add more jsonld rules * build: ensure to pass url * build: move rule low priority * build: ensure to decode html entities * build: setup better image rules * test: update snapshot * build: remove jsonLd variable * docs: tweaks * test: update snapshot
- Loading branch information
Showing
22 changed files
with
3,671 additions
and
1,564 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
packages/metascraper-helpers/__snapshots__/index.js.snap-shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
exports['object if JSON-LD is preset into the html 1'] = { | ||
"@context": "http://schema.org", | ||
"@type": "NewsArticle", | ||
"mainEntityOfPage": "https://www.theverge.com/2017/11/16/16667366/tesla-semi-truck-announced-price-release-date-electric-self-driving", | ||
"headline": "This is the Tesla Semi truck", | ||
"description": "500 miles of range and more aerodynamic than a supercar", | ||
"speakable": { | ||
"@type": "SpeakableSpecification", | ||
"xpath": [ | ||
"/html/head/title", | ||
"/html/head/meta[@name='description']/@content" | ||
] | ||
}, | ||
"datePublished": "2017-11-16T23:47:07-05:00", | ||
"dateModified": "2017-11-16T23:47:07-05:00", | ||
"author": { | ||
"@type": "Person", | ||
"name": "Zac Estrada" | ||
}, | ||
"publisher": { | ||
"@type": "Organization", | ||
"name": "The Verge", | ||
"logo": { | ||
"@type": "ImageObject", | ||
"url": "https://cdn.vox-cdn.com/uploads/chorus_asset/file/13668586/google_amp.0.png", | ||
"width": 600, | ||
"height": 60 | ||
} | ||
}, | ||
"about": { | ||
"@type": "Event", | ||
"name": "Tesla Semi Truck Event 2017", | ||
"startDate": "2017-11-17T04:00:00+00:00", | ||
"location": { | ||
"@type": "Place", | ||
"name": "Tesla Motors factory", | ||
"address": "Hawthorne, California, USA" | ||
} | ||
}, | ||
"image": [ | ||
{ | ||
"@type": "ImageObject", | ||
"url": "https://cdn.vox-cdn.com/thumbor/k8ssXKPAuRwxa1pKew982ZMgv0o=/1400x1400/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/9699573/Semi_Front_Profile.jpg", | ||
"width": 1400, | ||
"height": 1400 | ||
}, | ||
{ | ||
"@type": "ImageObject", | ||
"url": "https://cdn.vox-cdn.com/thumbor/l6nkV8CkJIdUrJIzHFWUFc1zLRM=/1400x1050/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/9699573/Semi_Front_Profile.jpg", | ||
"width": 1400, | ||
"height": 1050 | ||
}, | ||
{ | ||
"@type": "ImageObject", | ||
"url": "https://cdn.vox-cdn.com/thumbor/5Sqo6J73lBi1hwzEiKCQy6FLx3I=/1400x788/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/9699573/Semi_Front_Profile.jpg", | ||
"width": 1400, | ||
"height": 788 | ||
} | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.