Socket
Book a DemoInstallSign in
Socket

@silverbirder/o-embed

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@silverbirder/o-embed

Webcomponent o-embed following open-wc recommendations

0.0.10
latest
npmnpm
Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

Published on webcomponents.org codecov storybook

<o-embed>

<o-embed> is Web Components for oEmbed generated by open-wc.

oEmbed

oEmbed means the following.

oEmbed is a format for allowing an embedded representation of a URL on third party sites.

For example, in the case of Tweet, you will see the following embed.

open wc tweet

The URL for the Tweet is bellow.

  • https://twitter.com/openwc/status/1427617679427440643

The URL for Tweet's oEmbed API is bellow.

  • https://publish.twitter.com/oembed? url=https://twitter.com/openwc/status/1427617679427440643

Usage

<script type="module">
  import { OEmbed } from 'https://cdn.skypack.dev/@silverbirder/o-embed';

  window.customElements.define("o-embed", OEmbed);
</script>

<o-embed
  src="https://twitter.com/openwc/status/1427617679427440643"
  proxy="https://silverbirder-cors-anywhere.herokuapp.com"
></o-embed>

Attributes

AttributeTypeRequiredDefaultDescription
srcStringtrue""URL to embed.
It must be supported by the provider.
proxyStringtrue""URL of proxy.
The details is here(Proxy).
heightStringfalse""height of iframe
weightStringfalse""weight of iframe
providerStringfalse"https://oembed.com/providers.json"URL of providers

Proxy

Some of provider is not allow cross-origin HTTP request and oembed will not work with those site. You need to put proxy url to make it work. I would suggest to use cors-anywhere.herokuapp.com as your proxy. Self hosted version is provide at https://github.com/Rob--W/cors-anywhere/.

https://www.webcomponents.org/element/thangman22/oembed-component

Slot

<o-embed>
  <p slot="loading">Loading...</p>
  <p slot="notFound">Not Found</p>
  <p slot="error">Error</p>
</o-embed>
SlotCondition
loadingWhile loading src
notFoundProvider of src does not exist
errorWhen unknown errors occur

Installation

npm i @silverbirder/o-embed

FAQs

Package last updated on 21 May 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.