feat(sponsorblock): handle nullable actionType

This commit is contained in:
FineFindus 2024-01-04 21:21:35 +01:00
parent eecff5378d
commit 9f30df1f80
No known key found for this signature in database
GPG key ID: 64873EE210FF8E6B

View file

@ -30,11 +30,14 @@ public class SponsorBlockUtils {
String hash = DigestUtils.sha256Hex(id);
for (String url : Constants.SPONSORBLOCK_SERVERS) {
for (String apiUrl : Constants.SPONSORBLOCK_SERVERS) {
try {
String url =apiUrl + "/api/skipSegments/" + URLUtils.silentEncode(hash.substring(0, 4))
+ "?categories=" + URLUtils.silentEncode(categories);
if (actionType != null && !actionType.isBlank())
url += "&actionTypes=" + URLUtils.silentEncode(actionType);
var resp = RequestUtils.sendGetRaw(url + "/api/skipSegments/" + URLUtils.silentEncode(hash.substring(0, 4))
+ "?categories=" + URLUtils.silentEncode(categories) + "&actionTypes=" + URLUtils.silentEncode(actionType)).get();
var resp = RequestUtils.sendGetRaw(url).get();
if (resp.status() == 200) {
var any = mapper.readTree(resp.body());