🚸 Enable OneDrive video url parsing
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
|||||||
VideoBubbleContentType,
|
VideoBubbleContentType,
|
||||||
gumletRegex,
|
gumletRegex,
|
||||||
horizontalVideoSuggestionSize,
|
horizontalVideoSuggestionSize,
|
||||||
|
oneDriveRegex,
|
||||||
tiktokRegex,
|
tiktokRegex,
|
||||||
verticalVideoSuggestionSize,
|
verticalVideoSuggestionSize,
|
||||||
vimeoRegex,
|
vimeoRegex,
|
||||||
@@ -70,5 +71,13 @@ export const parseVideoUrl = (
|
|||||||
videoSizeSuggestion: horizontalVideoSuggestionSize,
|
videoSizeSuggestion: horizontalVideoSuggestionSize,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (oneDriveRegex.test(url)) {
|
||||||
|
const match = url.match(oneDriveRegex)
|
||||||
|
const parsedUrl = match?.at(0) ?? url
|
||||||
|
return {
|
||||||
|
type: VideoBubbleContentType.URL,
|
||||||
|
url: parsedUrl.replace('/embed', '/download'),
|
||||||
|
}
|
||||||
|
}
|
||||||
return { type: VideoBubbleContentType.URL, url }
|
return { type: VideoBubbleContentType.URL, url }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ export const tiktokRegex = /tiktok\.com\/@[\w-]+\/video\/(\d+)/
|
|||||||
const gumletBaseUrl = 'https://play.gumlet.io/embed'
|
const gumletBaseUrl = 'https://play.gumlet.io/embed'
|
||||||
export const gumletRegex = /gumlet\.com\/watch\/(\w+)/
|
export const gumletRegex = /gumlet\.com\/watch\/(\w+)/
|
||||||
|
|
||||||
|
export const oneDriveRegex = /https:\/\/onedrive.live.com\/embed\?[^"]+/
|
||||||
|
|
||||||
export const embedBaseUrls = {
|
export const embedBaseUrls = {
|
||||||
[VideoBubbleContentType.VIMEO]: vimeoBaseUrl,
|
[VideoBubbleContentType.VIMEO]: vimeoBaseUrl,
|
||||||
[VideoBubbleContentType.YOUTUBE]: youtubeBaseUrl,
|
[VideoBubbleContentType.YOUTUBE]: youtubeBaseUrl,
|
||||||
|
|||||||
Reference in New Issue
Block a user