From 89a8737bcd31812c67fc3aea72da9faf9df1a2e3 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Sat, 4 Mar 2023 20:46:39 +0000 Subject: [PATCH] Fix for non-utf-8 URLs from LBRY. --- src/main/java/me/kavin/piped/utils/LbryHelper.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/me/kavin/piped/utils/LbryHelper.java b/src/main/java/me/kavin/piped/utils/LbryHelper.java index f184998..af92e45 100644 --- a/src/main/java/me/kavin/piped/utils/LbryHelper.java +++ b/src/main/java/me/kavin/piped/utils/LbryHelper.java @@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils; import rocks.kavin.reqwest4j.ReqwestUtils; import java.io.IOException; +import java.net.URI; import java.util.Map; import static me.kavin.piped.consts.Constants.mapper; @@ -56,6 +57,9 @@ public class LbryHelper { if (StringUtils.isEmpty(streamUrl)) return null; + // LBRY provides non UTF-8 characters in the URL, which causes issues + streamUrl = new URI(streamUrl).toASCIIString(); + var resp = ReqwestUtils.fetch(streamUrl, "HEAD", null, Map.of( "Origin", "https://odysee.com", "Referer", "https://odysee.com/"