Merge pull request #543 from TeamPiped/lbry-encoding-fix

Fix for non-utf-8 URLs from LBRY.
This commit is contained in:
Kavin 2023-03-04 20:47:39 +00:00 committed by GitHub
commit 88f899fd51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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