Created
May 10, 2018 21:49
-
-
Save Kikobeats/a700ad878db7282bdda58fb6c082df9c to your computer and use it in GitHub Desktop.
Microlink API custom rules integration
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
'use strict' | |
const microlinkAPI = require('microlink-api')('YOUR_API_KEY') | |
;(async() => { | |
const url = 'https://google.com' | |
const opts = { | |
prerender: false, | |
// You can extend the current rules or add more! | |
rules: { | |
type: [ | |
({ htmlDom: $, meta, url: baseUrl }) => { | |
const value = $('meta[property="og:site_name"]') || 'web' | |
return value | |
} | |
] | |
} | |
} | |
const {status, data} = await microlinkAPI(url, opts) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment