Fix for non-utf-8 URLs from LBRY.

This commit is contained in:
Kavin 2023-03-04 20:46:39 +00:00
parent a08151475e
commit 89a8737bcd
No known key found for this signature in database
GPG key ID: 49451E4482CC5BCD

View file

@ -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/"