Wrapper around https://github.com/radiovisual/get-video-id to return video service query params (youtube starts from
as an example )
yarn add @shelf/get-video-id
import getVideoId from '@shelf/get-video-id';
getVideoId('https://youtu.be/LqTuxFElqag');
/** => {
id: 'LqTuxFElqag',
service: 'youtube',
embedURL: 'https://www.youtube.com/embed/LqTuxFElqag'
} **/
getVideoId('https://youtu.be/LqTuxFElqag?t=7939'); // With time param
/** => {
id: 'LqTuxFElqag',
service: 'youtube',
embedURL: 'https://www.youtube.com/embed/LqTuxFElqag?start=7939'
} **/
getVideoId('https://vimeo.com/259411563#t=50s');
/** => {
id: '259411563',
service: 'vimeo',
embedURL: 'https://player.vimeo.com/video/259411563'
} **/
Documentation is available here
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
MIT © Shelf