using System.Text.RegularExpressions; namespace VideoDownloader.Mobile; /// M1 공유 타겟(U1): 다른 앱에서 공유받은 텍스트에서 전송할 URL 추출. /// 유튜브 공유 시트는 "제목 + https://youtu.be/..." 형식 — 텍스트 중 첫 http(s) URL. public static partial class SharePayload { [GeneratedRegex(@"https?://[^\s]+")] private static partial Regex UrlRegex(); public static string? ExtractUrl(string? sharedText) { if (string.IsNullOrWhiteSpace(sharedText)) return null; var m = UrlRegex().Match(sharedText); return m.Success ? m.Value.TrimEnd(')', ']', '}', ',', '.', ';') : null; } }