How to use oembed-parser - 10 common examples

To help you get started, we’ve selected a few oembed-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lowwebtech / low-web-extension / src / scripts / content_script / video / players / ClickToPlayer.js View on Github external
(function(){

  console.log('ClickToPlayer')
  setProviderList(providersJson)

  let players = document.querySelectorAll('.lowweb__click-to-load')
  players.forEach(( player )=>{

    let videoUrl, oembedUrl
    const type = player.dataset.lowtype
    const data = videoToBlock[type]

    // button
    if( data.icon ){
      player.innerHTML = data.icon 
    }

    const id = getId( player.dataset.lowsrc, type )

    if( data.video_url != '' && data.oembed != '' && id ) {
github chadly / ghost / core / server / api / v0.1 / oembed.js View on Github external
const findUrlWithProvider = (url) => {
    let provider;

    // build up a list of URL variations to test against because the oembed
    // providers list is not always up to date with scheme or www vs non-www
    let baseUrl = url.replace(/^\/\/|^https?:\/\/(?:www\.)?/, '');
    let testUrls = [
        `http://${baseUrl}`,
        `https://${baseUrl}`,
        `http://www.${baseUrl}`,
        `https://www.${baseUrl}`
    ];

    for (let testUrl of testUrls) {
        provider = hasProvider(testUrl);
        if (provider) {
            url = testUrl;
            break;
        }
    }

    return {url, provider};
};
github TryGhost / Ghost / core / server / api / canary / oembed.js View on Github external
const findUrlWithProvider = (url) => {
    let provider;

    // build up a list of URL variations to test against because the oembed
    // providers list is not always up to date with scheme or www vs non-www
    let baseUrl = url.replace(/^\/\/|^https?:\/\/(?:www\.)?/, '');
    let testUrls = [
        `http://${baseUrl}`,
        `https://${baseUrl}`,
        `http://www.${baseUrl}`,
        `https://www.${baseUrl}`
    ];

    for (let testUrl of testUrls) {
        provider = hasProvider(testUrl);
        if (provider) {
            url = testUrl;
            break;
        }
    }

    return {url, provider};
};
github TryGhost / Ghost / core / server / api / v2 / oembed.js View on Github external
const findUrlWithProvider = (url) => {
    let provider;

    // build up a list of URL variations to test against because the oembed
    // providers list is not always up to date with scheme or www vs non-www
    let baseUrl = url.replace(/^\/\/|^https?:\/\/(?:www\.)?/, '');
    let testUrls = [
        `http://${baseUrl}`,
        `https://${baseUrl}`,
        `http://www.${baseUrl}`,
        `https://www.${baseUrl}`
    ];

    for (let testUrl of testUrls) {
        provider = hasProvider(testUrl);
        if (provider) {
            url = testUrl;
            break;
        }
    }

    return {url, provider};
};
github TryGhost / Ghost / core / server / api / v0.1 / oembed.js View on Github external
const findUrlWithProvider = (url) => {
    let provider;

    // build up a list of URL variations to test against because the oembed
    // providers list is not always up to date with scheme or www vs non-www
    let baseUrl = url.replace(/^\/\/|^https?:\/\/(?:www\.)?/, '');
    let testUrls = [
        `http://${baseUrl}`,
        `https://${baseUrl}`,
        `http://www.${baseUrl}`,
        `https://www.${baseUrl}`
    ];

    for (let testUrl of testUrls) {
        provider = hasProvider(testUrl);
        if (provider) {
            url = testUrl;
            break;
        }
    }

    return {url, provider};
};
github TryGhost / Ghost / core / server / api / v0.1 / oembed.js View on Github external
function knownProvider(url) {
            return extract(url).catch((err) => {
                return Promise.reject(new common.errors.InternalServerError({
                    message: err.message
                }));
            });
        }
github chadly / ghost / core / server / api / v0.1 / oembed.js View on Github external
function knownProvider(url) {
            return extract(url).catch((err) => {
                return Promise.reject(new common.errors.InternalServerError({
                    message: err.message
                }));
            });
        }
github TryGhost / Ghost / core / server / api / canary / oembed.js View on Github external
function knownProvider(url) {
    return extract(url).catch((err) => {
        return Promise.reject(new common.errors.InternalServerError({
            message: err.message
        }));
    });
}
github TryGhost / Ghost / core / server / api / v2 / oembed.js View on Github external
function knownProvider(url) {
                return extract(url).catch((err) => {
                    return Promise.reject(new common.errors.InternalServerError({
                        message: err.message
                    }));
                });
            }
github ndaidong / article-parser / src / parsers / extensions / youtube.js View on Github external
return new Promise((resolve, reject) => {
      const vid = getYtid(url);

      if (!vid) {
        throw new Error('No video ID found');
      }

      url = `https://www.youtube.com/watch?v=${vid}`;

      return extract(url).then((data) => {
        return {
          vid,
          title: data.title,
          canonicals: [
            url,
            `https://youtu.be/${vid}`,
            `https://www.youtube.com/v/${vid}`,
            `https://www.youtube.com/embed/${vid}`,
          ],
          content: ``,
          author: data.author_name,
          source: data.provider_name,
          image: data.thumbnail_url,
        };
      }).then((art) => {
        return getDuration(art.vid).then((duration) => {

oembed-parser

Get oEmbed data from given URL.

MIT
Latest version published 1 year ago

Package Health Score

67 / 100
Full package analysis