Skip to content
Extract oEmbed data from given webpage
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.eslintignore
.eslintrc.json
.gitignore
.travis.yml
LICENSE
README.md
index.d.ts
index.js
package.json
reset.js
sync.js

README.md

oembed-parser

NPM Build Status

Installation

npm install oembed-parser

Usage

const {
  extract,
} = require('oembed-parser');

let url = 'https://www.youtube.com/watch?v=8jPQjjsBbIc';

// Promise style
extract(url).then((data) => {
  console.log(data);
}).catch((err) => {
  console.log(err);
});


// async/await style
const getArticle = async (link) => {
  try {
    let data = await extract(link);
    return data;
  } catch (err) {
    return err;
  }
}

console.log(getArticle(url));

APIs

.extract(String URL)

Return a Promise object.

.hasProvider(String URL)

Return boolean. True if the URL matches with any provider in the list.

Provider list

List of resource providers is a clone of oembed.com and available here.

Test

git clone https://github.com/ndaidong/oembed-parser.git
cd oembed-parser
npm install
npm test

License

The MIT License (MIT)

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.