![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
oembed-parser
Advanced tools
Extract oEmbed content from given URL.
Node.js
npm i oembed-parser
# pnpm
pnpm i oembed-parser
# yarn
yarn add oembed-parser
import { extract } from 'oembed-parser'
// with CommonJS environments
// const { extract } = require('oembed-parser')
// or specify exactly path to cjs variant
// const { extract } = require('oembed-parser/dist/cjs/oembed-parser.js')
const url = 'https://www.youtube.com/watch?v=x2bqscVkGxk'
extract(url).then((oembed) => {
console.log(oembed)
}).catch((err) => {
console.trace(err)
})
.extract(String url [, Object params])
Load and extract oembed data.
Example:
import { extract } from 'oembed-parser'
const getOembed = async (url) => {
try {
const oembed = await extract(url)
return oembed
} catch (err) {
console.trace(err)
return null
}
}
const data = getOembed('your url')
console.log(data)
Optional argument params
can be useful when you want to specify some additional customizations.
Here are several popular params:
maxwidth
: max width of embed sizemaxheight
: max height of embed sizetheme
: e.g, dark
or light
lang
: e.g, 'en', 'fr', 'cn', 'vi', etcNote that some params are supported by these providers but not by the others. Please see the provider's oEmbed API docs carefully for exact information.
.setProviderList(Array providers)
Apply a list of providers to use, overriding the default.
This can be useful for whitelisting only certain providers, or for adding custom providers.
Default list of resource providers is synchronized from oembed.com.
For example:
import { setProviderList } from 'oembed-parser'
const providers = [
{
provider_name: 'Alpha',
provider_url: 'https://alpha.com',
endpoints: [
// endpoint definition here
]
},
{
provider_name: 'Beta',
provider_url: 'https://beta.com',
endpoints: [
// endpoint definition here
]
}
]
setProviderList(providers)
In order to work with the links from Facebook and Instagram, you need a reviewed Facebook's app with oEmbed Read permission.
When seeing a link from Facebook or Instagram, oembed-parser
will look for environment variables FACEBOOK_APP_ID
and FACEBOOK_CLIENT_TOKEN
to retrieve oembed data using your app credentials.
For example:
export FACEBOOK_APP_ID=your_app_id
export FACEBOOK_CLIENT_TOKEN=your_client_token
npm run eval https://www.instagram.com/tv/CVlR5GFqF68/
git clone https://github.com/ndaidong/oembed-parser.git
cd oembed-parser
npm install
npm test
# quick evaluation
npm run eval {URL_TO_PARSE_OEMBED}
The MIT License (MIT)
FAQs
Get oEmbed data from given URL.
The npm package oembed-parser receives a total of 0 weekly downloads. As such, oembed-parser popularity was classified as not popular.
We found that oembed-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.