Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Commit

Permalink
Use getAttribute #57
Browse files Browse the repository at this point in the history
Fixes #57
  • Loading branch information
jaredlockhart committed Aug 25, 2016
1 parent 9943dc9 commit 74888a5
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,40 @@ function buildRuleset(name, rules) {

const metadataRules = {
description: [
['meta[property="og:description"]', node => node.element.content],
['meta[name="description"]', node => node.element.content],
['meta[property="og:description"]', node => node.element.getAttribute('content')],
['meta[name="description"]', node => node.element.getAttribute('content')],
],
icon_url: [
['link[rel="apple-touch-icon"]', node => node.element.href],
['link[rel="apple-touch-icon-precomposed"]', node => node.element.href],
['link[rel="icon"]', node => node.element.href],
['link[rel="fluid-icon"]', node => node.element.href],
['link[rel="shortcut icon"]', node => node.element.href],
['link[rel="Shortcut Icon"]', node => node.element.href],
['link[rel="mask-icon"]', node => node.element.href],
['link[rel="apple-touch-icon"]', node => node.element.getAttribute('href')],
['link[rel="apple-touch-icon-precomposed"]', node => node.element.getAttribute('href')],
['link[rel="icon"]', node => node.element.getAttribute('href')],
['link[rel="fluid-icon"]', node => node.element.getAttribute('href')],
['link[rel="shortcut icon"]', node => node.element.getAttribute('href')],
['link[rel="Shortcut Icon"]', node => node.element.getAttribute('href')],
['link[rel="mask-icon"]', node => node.element.getAttribute('href')],
],
image_url: [
['meta[property="og:image:secure_url"]', node => node.element.content],
['meta[property="og:image:url"]', node => node.element.content],
['meta[property="og:image"]', node => node.element.content],
['meta[property="twitter:image"]', node => node.element.content],
['meta[name="thumbnail"]', node => node.element.content],
['meta[property="og:image:secure_url"]', node => node.element.getAttribute('content')],
['meta[property="og:image:url"]', node => node.element.getAttribute('content')],
['meta[property="og:image"]', node => node.element.getAttribute('content')],
['meta[property="twitter:image"]', node => node.element.getAttribute('content')],
['meta[name="thumbnail"]', node => node.element.getAttribute('content')],
],
keywords: [
['meta[name="keywords"]', node => node.element.content],
['meta[name="keywords"]', node => node.element.getAttribute('content')],
],
title: [
['meta[property="og:title"]', node => node.element.content],
['meta[property="twitter:title"]', node => node.element.content],
['meta[name="hdl"]', node => node.element.content],
['meta[property="og:title"]', node => node.element.getAttribute('content')],
['meta[property="twitter:title"]', node => node.element.getAttribute('content')],
['meta[name="hdl"]', node => node.element.getAttribute('content')],
['title', node => node.element.text],
],
type: [
['meta[property="og:type"]', node => node.element.content],
['meta[property="og:type"]', node => node.element.getAttribute('content')],
],
url: [
['meta[property="og:url"]', node => node.element.content],
['link[rel="canonical"]', node => node.element.href],
['meta[property="og:url"]', node => node.element.getAttribute('content')],
['link[rel="canonical"]', node => node.element.getAttribute('href')],
],
};

Expand Down

0 comments on commit 74888a5

Please sign in to comment.