Socket
Book a DemoInstallSign in
Socket

media-url-parser

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

media-url-parser

Install with `yarn add media-url-parser` as a [npm package](https://www.npmjs.com/package/media-url-parser).

0.2.4
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

media-url-parser

Install with yarn add media-url-parser as a npm package.

Or load from a CDN

<script type="module">
  import mediaUrlParser from 'https://unpkg.com/media-url-parser'
  const x = mediaUrlParser('https://www.youtube.com/watch?v=EFh-vtZHjOQ')
  console.log(x) // {url: "https://www.youtube.com/watch?v=EFh-vtZHjOQ", provider: "youtube", id: "EFh-vtZHjOQ"}
</script>

Usage:

const urlA = 'https://www.youtube.com/watch?v=OkR7UNnQU6c'
const urlB = '192.168.0.1/a/longer/path/podcast.ogg'

const resultsA = mediaUrlParser(urlA)
const resultsB = mediaUrlParser(urlB)

This code will output:

// resultsA
{
    url: 'https://www.youtube.com/watch?v=OkR7UNnQU6c',
    provider: 'youtube',
    id: 'OkR7UNnQU6c'
}

// resultsB
{
    url: 'https://192.168.0.1/a/longer/path/podcast.ogg',
    provider: 'file',
    id: 'podcast.ogg' 
}

Supported providers are:

  • youtube
  • file (only remote for now, not local files)
  • discogs

Possible future providers are:

Suggestions and PR welcome.

FAQs

Package last updated on 29 Oct 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.