From 642354fc8e204b406d8aab853e6e2f7e5ec01363 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Tue, 23 Aug 2022 19:46:36 +0200 Subject: [PATCH] Fix parsing timestamps with Piped --- Model/Applications/PipedAPI.swift | 2 ++ Shared/Player/VideoDescription.swift | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Model/Applications/PipedAPI.swift b/Model/Applications/PipedAPI.swift index e47e5271..3759d45f 100644 --- a/Model/Applications/PipedAPI.swift +++ b/Model/Applications/PipedAPI.swift @@ -515,6 +515,8 @@ final class PipedAPI: Service, ObservableObject, VideosAPI { return matchingGroup } + description = description.replacingOccurrences(of: "&", with: "&") + description = description.replacingOccurrences( of: "<[^>]+>", with: "", diff --git a/Shared/Player/VideoDescription.swift b/Shared/Player/VideoDescription.swift index f48355d7..e6614106 100644 --- a/Shared/Player/VideoDescription.swift +++ b/Shared/Player/VideoDescription.swift @@ -122,10 +122,17 @@ struct VideoDescription: View { if var components = URLComponents(url: url, resolvingAgainstBaseURL: false) { components.scheme = "yattee" - if let yatteeURL = components.url, - URLParser(url: urlToOpen).destination != nil - { - urlToOpen = yatteeURL + if let yatteeURL = components.url { + let parser = URLParser(url: urlToOpen) + if parser.destination == .video, + parser.videoID == player.currentVideo?.videoID, + let time = parser.time + { + player.backend.seek(to: Double(time)) + return + } else { + urlToOpen = yatteeURL + } } }