JSPM

  • Created
  • Published
  • Downloads 3098
  • Score
    100M100P100Q114534F
  • License BSD-3-Clause

Extracts content information from known URL patterns.

Package Exports

  • semantic-url-parser
  • semantic-url-parser/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (semantic-url-parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

semantic-url-parser 🗂️

Extracts content information from known URL patterns.

import {
  extractContentInfoFromUrl,
} from 'semantic-url-parser';

extractContentInfoFromUrl('https://youtu.be/8Qn_spdM5Zg?t=5');

// {
//   contentType: 'VIDEO',
//   videoId: '8Qn_spdM5Zg',
//   site: 'YOUTUBE',
//   url: 'https://www.youtube.com/watch?v=8Qn_spdM5Zg'
// }

extractContentInfoFromUrl('https://soundcloud.com/strangehumman/kyoto-2?utm_source=clipboard&utm_medium=text&utm_campaign=social_sharing');

// {
//   contentType: 'AUDIO_TRACK',
//   audioTrackId: 'kyoto-2',
//   username: 'strangehumman',
//   url: 'https://soundcloud.com/strangehumman/kyoto-2',
// }

Supported Sites

Adding New Sites

  1. Update SiteContentInfo
  2. Update siteContentRules
  3. Update "Supported Sites" documentation