mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Merge pull request #538 from TeamPiped/lbry-hls
Remove okhttp for reqwest.
This commit is contained in:
commit
20bff208d2
1 changed files with 11 additions and 14 deletions
|
@ -1,7 +1,6 @@
|
||||||
package me.kavin.piped.utils;
|
package me.kavin.piped.utils;
|
||||||
|
|
||||||
import me.kavin.piped.consts.Constants;
|
import me.kavin.piped.consts.Constants;
|
||||||
import okhttp3.Request;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import rocks.kavin.reqwest4j.ReqwestUtils;
|
import rocks.kavin.reqwest4j.ReqwestUtils;
|
||||||
|
|
||||||
|
@ -54,18 +53,16 @@ public class LbryHelper {
|
||||||
|
|
||||||
public static String getLBRYHlsUrl(String streamUrl) throws Exception {
|
public static String getLBRYHlsUrl(String streamUrl) throws Exception {
|
||||||
|
|
||||||
try (var resp = Constants.h2_no_redir_client
|
if (StringUtils.isEmpty(streamUrl))
|
||||||
.newCall(
|
return null;
|
||||||
new Request.Builder()
|
|
||||||
.url(streamUrl)
|
var resp = ReqwestUtils.fetch(streamUrl, "HEAD", null, Map.of(
|
||||||
.method("HEAD", null)
|
"Origin", "https://odysee.com",
|
||||||
.header("User-Agent", Constants.USER_AGENT)
|
"Referer", "https://odysee.com/"
|
||||||
.header("Origin", "https://odysee.com")
|
));
|
||||||
.header("Referer", "https://odysee.com/")
|
|
||||||
.build()
|
final String lastLocation = resp.finalUrl();
|
||||||
)
|
|
||||||
.execute()) {
|
return streamUrl.equals(lastLocation) ? null : lastLocation;
|
||||||
return resp.header("Location");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue