From 8b32824bb9c63c9a39f5d41d6d786f619c32ac81 Mon Sep 17 00:00:00 2001 From: Subhamoy Biswas Date: Sun, 10 Aug 2025 22:19:49 +0530 Subject: [PATCH] fix: infinite search loop due to yt-dlp fragment missing error on windows --- src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe | 4 ++-- src/App.tsx | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe b/src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe index 1c575aa..0029c3d 100644 --- a/src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe +++ b/src-tauri/binaries/yt-dlp-x86_64-pc-windows-msvc.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5fa4862eb50050941370fa78a8c56faa31516d5abaf1f7cf31bc56de166347d9 -size 18123562 +oid sha256:aad1281d4d87b82ba44882b233451e2a605b0ab20ff6b0fd0efee7f9d129ad61 +size 18116266 diff --git a/src/App.tsx b/src/App.tsx index 43dd402..383d2ec 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -129,8 +129,14 @@ export default function App({ children }: { children: React.ReactNode }) { resolve(null); } else { try { - const parsedData: RawVideoInfo = JSON.parse(jsonOutput); - resolve(parsedData); + const matchedJson = jsonOutput.match(/{.*}/); + if (!matchedJson) { + console.error(`Failed to match JSON: ${jsonOutput}`); + resolve(null); + return; + } + const parsedJson: RawVideoInfo = JSON.parse(matchedJson[0]); + resolve(parsedJson); } catch (e) { console.error(`Failed to parse JSON: ${e}`);