A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodeca/embedza below:

nodeca/embedza: Create HTML snippets/embeds from URLs using info from oEmbed, Open Graph, meta tags.

Create HTML snippets/embeds from URLs using info from oEmbed, Open Graph, meta tags.

Key feature:

Live Demo

npm install embedza --save

run dev server (with debug messages):

DEBUG=embedza:* npm start

Render player for youtube video:

const Embedza = require('embedza');
const embedza = new Embedza();

embedza.render('https://www.youtube.com/watch?v=JrZSfMiVC88', 'block')
  .then(result => {
    if (result) console.log(result.html, result.type);
  });
});

Creates new Embedza instance with specified options:

.render(url, type) -> Promise

Try to create HTML snippet of requested type by URL.

Returns:

If url can not be rendered - returns null. On remote errors fails with error info.

Similar to .render(), but returns object with full url description.

Returns:

If url info does not exists - returns null. On remote errors fails with error info.

Iterates through domains rules to modify those.

Get domain rule by name.

Rerister new service. If String passed - enable domain with default rules. If Object passed - create custom configuration:

Add add data fetcher. Options:

Add mixin (data handler). Options:

Add post-processor "after" handler. The same as .addMixin, but handlers are axecuted after all mixins. Options:

By default it's a wrapper for request. You can override it. For example to force use cache only.

Manage available templates:

const _       = require('lodash');
const Embedza = require('embedza');
const embedza = new Embedza();

// Customize templates
embedza.templates['default_inline'] = _.template('...template code...', { variable: 'self' });
embedza.templates['youtube.com_player'] = _.template('...template code...', { variable: 'self' });

// Customize template aliases
embedza.aliases.block = [ 'player', 'photo' ];

Embedza is inspired by projects above, but designed to satisfy our requirements. For example, it supports inline output format.

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4