fix(media utils): add m.youtube

This commit is contained in:
plebeius.eth
2024-01-20 18:09:28 +01:00
parent fbd05cd4b7
commit c81d240b90
2 changed files with 2 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ interface EmbedComponentProps {
parsedUrl: URL;
}
const youtubeHosts = new Set<string>(['youtube.com', 'www.youtube.com', 'youtu.be', 'www.youtu.be']);
const youtubeHosts = new Set<string>(['youtube.com', 'www.youtube.com', 'youtu.be', 'www.youtu.be', 'm.youtube.com']);
const YoutubeEmbed = ({ parsedUrl }: EmbedComponentProps) => {
let youtubeId;

View File

@@ -39,7 +39,7 @@ const getCommentMediaInfo = (comment: Comment) => {
const host = url.hostname;
let patternThumbnailUrl;
if (['youtube.com', 'www.youtube.com', 'youtu.be'].includes(host)) {
if (['youtube.com', 'www.youtube.com', 'youtu.be', 'www.youtu.be', 'm.youtube.com'].includes(host)) {
const videoId = host === 'youtu.be' ? url.pathname.slice(1) : url.searchParams.get('v');
patternThumbnailUrl = `https://img.youtube.com/vi/${videoId}/0.jpg`;
} else if (host.includes('streamable.com')) {