Skip to content

Function for embeds parsing/analyze with test coverage.

Notifications You must be signed in to change notification settings

mobilon-dev/text-extract-embeds

 
 

Repository files navigation

@mobilon-dev/text-extract-embeds

const {analyzeEmbed} = require('@mobilon-dev/text-extract-embeds');

const input = [
  'YouTube: https://www.youtube.com/watch?v=dQw4w9WgXcQ ',
  'Vimeo: https://vimeo.com/123456789 ',
  'Rutube: https://rutube.ru/video/b1c6f3a861e2e4f84179ba2f92521a57/ ',
  'VK: https://vk.com/video-45256126_456242536',
].join('');

const result = analyzeEmbed(input);

console.log('e', JSON.stringify(result));

// [
//  {"type":"youtube","videoId":"dQw4w9WgXcQ","url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","index":9},
//  {"type":"vimeo","videoId":"123456789","url":"https://vimeo.com/123456789","index":60},
//  {"type":"rutube","videoId":"b1c6f3a861e2e4f84179ba2f92521a57","url":"https://rutube.ru/video/b1c6f3a861e2e4f84179ba2f92521a57/","index":96},
//  {"type":"vk_video","videoId":"45256126_456242536","url":"https://vk.com/video-45256126_456242536","index":158}
// ]

About

Function for embeds parsing/analyze with test coverage.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.1%
  • JavaScript 1.9%