Embed youtube shorts (#1225)
This commit is contained in:
parent
23c51df283
commit
79ed07ae74
12
lib/url.js
12
lib/url.js
@ -79,7 +79,8 @@ export function parseEmbedUrl (href) {
|
||||
try {
|
||||
const { hostname, pathname, searchParams } = new URL(href)
|
||||
|
||||
if (hostname.endsWith('youtube.com') && pathname.includes('/watch')) {
|
||||
if (hostname.endsWith('youtube.com')) {
|
||||
if (pathname.includes('/watch')) {
|
||||
return {
|
||||
provider: 'youtube',
|
||||
id: searchParams.get('v'),
|
||||
@ -90,6 +91,15 @@ export function parseEmbedUrl (href) {
|
||||
}
|
||||
}
|
||||
|
||||
if (pathname.includes('/shorts')) {
|
||||
const id = pathname.split('/').slice(-1).join()
|
||||
return {
|
||||
provider: 'youtube',
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hostname.endsWith('youtu.be') && pathname.length > 1) {
|
||||
return {
|
||||
provider: 'youtube',
|
||||
|
Loading…
x
Reference in New Issue
Block a user