Skip to content

Commit 2070f16

Browse files
waleedlatif1claude
andcommitted
fix(note-block): address embed URL matching issues
- Fix YouTube regex to handle v= anywhere in query params - Fix Twitch channel match to exclude /clip/ URLs - Remove Mux support (HLS not supported in most browsers) - Remove Bandcamp support (requires numeric IDs, not slugs) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0e99cd5 commit 2070f16

File tree

1 file changed

+2
-25
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block

1 file changed

+2
-25
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/note-block/note-block.tsx

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function getTwitchParent(): string {
4343
*/
4444
function getEmbedInfo(url: string): EmbedInfo | null {
4545
const youtubeMatch = url.match(
46-
/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/
46+
/(?:youtube\.com\/watch\?(?:.*&)?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/
4747
)
4848
if (youtubeMatch) {
4949
return { url: `https://www.youtube.com/embed/${youtubeMatch[1]}`, type: 'iframe' }
@@ -68,7 +68,7 @@ function getEmbedInfo(url: string): EmbedInfo | null {
6868
}
6969

7070
const twitchChannelMatch = url.match(/twitch\.tv\/([a-zA-Z0-9_]+)(?:\/|$)/)
71-
if (twitchChannelMatch && !url.includes('/videos/')) {
71+
if (twitchChannelMatch && !url.includes('/videos/') && !url.includes('/clip/')) {
7272
return {
7373
url: `https://player.twitch.tv/?channel=${twitchChannelMatch[1]}&parent=${getTwitchParent()}`,
7474
type: 'iframe',
@@ -240,11 +240,6 @@ function getEmbedInfo(url: string): EmbedInfo | null {
240240
return { url: `https://play.vidyard.com/${vidyardMatch[1]}`, type: 'iframe' }
241241
}
242242

243-
const muxMatch = url.match(/stream\.mux\.com\/([a-zA-Z0-9]+)/)
244-
if (muxMatch) {
245-
return { url: `https://stream.mux.com/${muxMatch[1]}.m3u8`, type: 'video' }
246-
}
247-
248243
const cfStreamMatch =
249244
url.match(/cloudflarestream\.com\/([a-zA-Z0-9]+)/) ||
250245
url.match(/videodelivery\.net\/([a-zA-Z0-9]+)/)
@@ -271,24 +266,6 @@ function getEmbedInfo(url: string): EmbedInfo | null {
271266
}
272267
}
273268

274-
const bandcampTrackMatch = url.match(/([a-zA-Z0-9-]+)\.bandcamp\.com\/track\/([a-zA-Z0-9-]+)/)
275-
if (bandcampTrackMatch) {
276-
return {
277-
url: `https://bandcamp.com/EmbeddedPlayer/artist=${bandcampTrackMatch[1]}/track=${bandcampTrackMatch[2]}/size=large/bgcol=333333/linkcol=0f91ff/tracklist=false/transparent=true/`,
278-
type: 'iframe',
279-
aspectRatio: '1/1',
280-
}
281-
}
282-
283-
const bandcampAlbumMatch = url.match(/([a-zA-Z0-9-]+)\.bandcamp\.com\/album\/([a-zA-Z0-9-]+)/)
284-
if (bandcampAlbumMatch) {
285-
return {
286-
url: `https://bandcamp.com/EmbeddedPlayer/artist=${bandcampAlbumMatch[1]}/album=${bandcampAlbumMatch[2]}/size=large/bgcol=333333/linkcol=0f91ff/transparent=true/`,
287-
type: 'iframe',
288-
aspectRatio: '1/1',
289-
}
290-
}
291-
292269
const googleDriveMatch = url.match(/drive\.google\.com\/file\/d\/([a-zA-Z0-9_-]+)/)
293270
if (googleDriveMatch) {
294271
return { url: `https://drive.google.com/file/d/${googleDriveMatch[1]}/preview`, type: 'iframe' }

0 commit comments

Comments
 (0)