Dectect the provider behind an embed-code.
npm install embedproviderDependecy-free dectection of providers behind embed-codes.
The detection happens by analyzing the src attribute of any element inside an embed-code, see the example below. (As a fallback the href attribute is also analyzed)
javascript
const embedprovider = require('embedprovider');
const result = embedprovider('');
console.log(result);
// { provider: 'vimeo', domain: 'vimeo.com' }
`$3
`javascript
const customProviderMap = [{
from: {
domain: 'mystr.com',
provider: 'mystr',
},
to: {
domain: 'servus.com',
provider: 'servus',
},
}];
const provider = embedprovider('', { customProviderMap }),
console.log(provider)
// { domain: 'servus.com', provider: 'servus' }
``