Skip to content

Commit

Permalink
fix(scan): page_date when itemprop="datePublished"[content]
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Mar 11, 2021
1 parent fbf0619 commit 91ee04e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scrap-site.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ module.exports = async (baseUrl, options = {}) => {
};

// page date from microformat
const pageDate = $('[itemprop="datePublished"][datetime]').first();
const pageDate = $('[itemprop="datePublished"]').first();
if (pageDate.length === 1) {
const dateStr = pageDate.attr('datetime');
const dateStr = pageDate.attr('datetime') || pageDate.attr('content');
const d = new Date(dateStr);
if (!isNaN(d.getTime())) {
result.page_date = dateStr.substring(0, 10);
Expand Down

0 comments on commit 91ee04e

Please sign in to comment.