Skip to content

Commit 2522915

Browse files
committed
Add instagram
1 parent bb76141 commit 2522915

File tree

4 files changed

+157
-0
lines changed

4 files changed

+157
-0
lines changed

src/get-data/rules/url.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ module.exports = [
2626
wrap($ => $('meta[property="og:url"]').attr('content')),
2727
wrap($ => $('meta[name="twitter:url"]').attr('content')),
2828
wrap($ => $('link[rel="canonical"]').attr('href')),
29+
wrap($ => $('link[rel="alternate"][hreflang="x-default"]').attr('href')),
2930
($, url) => isString(url) ? normalizeUrl(url) : null
3031
]

test/web/instagram/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict'
2+
3+
const {load: loadJSON} = require('json-future')
4+
const {resolve} = require('path')
5+
const {promisify} = require('util')
6+
const should = require('should')
7+
const fs = require('fs')
8+
9+
const getMetaData = require('../../..')
10+
const readFile = promisify(fs.readFile)
11+
12+
it('instagram', async () => {
13+
const html = await readFile(resolve(__dirname, 'input.html'))
14+
const json = await loadJSON(resolve(__dirname, 'output.json'))
15+
const metadata = await getMetaData({html})
16+
should(metadata).be.eql(json)
17+
})

test/web/instagram/input.html

Lines changed: 130 additions & 0 deletions
Large diffs are not rendered by default.

test/web/instagram/output.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"author": null,
3+
"date": "2017-07-09T04:58:10.000Z",
4+
"description": "139k Likes, 1,372 Comments - Tesla (@teslamotors) on Instagram: “The first Model 3 production car”",
5+
"image": "https://scontent.cdninstagram.com/t51.2885-15/e35/19955323_327280991034910_1996793346030305280_n.jpg",
6+
"publisher": "Instagram",
7+
"title": "Instagram post by Tesla • Jul 9, 2017 at 4:58am UTC",
8+
"url": "https://www.instagram.com/p/BWUDBntl3_Z"
9+
}

0 commit comments

Comments
 (0)