Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html2oembed

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html2oembed

Create oEmbed JSON from HTML

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

html2oembed

Node Version Latest Version on NPM Software License Buy us a tree Made by SWIS

Create oEmbed JSON from HTML

Install

Install with npm:

$ npm install --save-dev html2oembed

Basic usage

Via code:

const html2oembed = require('html2oembed');

const html = '<html><head><title>My awesome app</title><link href="/css/app.61f9f8cc.css" rel="stylesheet"></head><body><div id="app"></div><script type="text/javascript" src="/js/chunk-vendors.e42a3317.js"></script><script type="text/javascript" src="/js/app.c0e16a2e.js"></script></body></html>';
const parsed = html2oembed.parse(html);
const json = JSON.stringify(parsed);

Via CLI:

# Display help
$ npx html2oembed --help

# Convert HTML to oEmbed JSON
$ npx html2oembed convert ./index.html ./oembed.json

Sample output

{
  "version": "1.0",
  "type": "rich",
  "title": "My awesome app",
  "html": "<link href=\"/css/app.61f9f8cc.css\" rel=\"stylesheet\"><div id=\"app\"></div><script type=\"text/javascript\" src=\"/js/chunk-vendors.e42a3317.js\"></script><script type=\"text/javascript\" src=\"/js/app.c0e16a2e.js\"></script>",
  "width": "100%",
  "height": "100%"
}

Change log

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email security@swis.nl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

SWIS :heart: Open Source

SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.

Keywords

FAQs

Package last updated on 18 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc