File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
src/main/java/me/kavin/piped Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ AsyncServlet mainServlet(Executor executor) {
9999 try {
100100 return getJsonResponse (
101101 SponsorBlockUtils .getSponsors (request .getPathParameter ("videoId" ),
102- request .getQueryParameter ("category" )).getBytes (UTF_8 ),
102+ request .getQueryParameter ("category" ), request . getQueryParameter ( "actionType" ) ).getBytes (UTF_8 ),
103103 "public, max-age=3600" );
104104 } catch (Exception e ) {
105105 return getErrorResponse (e , request .getPath ());
Original file line number Diff line number Diff line change 2222
2323public class SponsorBlockUtils {
2424
25- public static String getSponsors (String id , String categories )
25+ public static String getSponsors (String id , String categories , String actionType )
2626 throws IOException {
2727
2828 if (StringUtils .isEmpty (categories ))
2929 return mapper .writeValueAsString (new InvalidRequestResponse ());
3030
3131 String hash = DigestUtils .sha256Hex (id );
3232
33- for (String url : Constants .SPONSORBLOCK_SERVERS ) {
33+ for (String apiUrl : Constants .SPONSORBLOCK_SERVERS ) {
3434 try {
35+ String url = apiUrl + "/api/skipSegments/" + URLUtils .silentEncode (hash .substring (0 , 4 ))
3536
36- var resp = RequestUtils .sendGetRaw (url + "/api/skipSegments/" + URLUtils .silentEncode (hash .substring (0 , 4 ))
37- + "?categories=" + URLUtils .silentEncode (categories )).get ();
37+ + "?categories=" + URLUtils .silentEncode (categories );
38+ if (actionType != null && !actionType .isBlank ())
39+ url += "&actionTypes=" + URLUtils .silentEncode (actionType );
40+
41+ var resp = RequestUtils .sendGetRaw (url ).get ();
3842
3943 if (resp .status () == 200 ) {
4044 var any = mapper .readTree (resp .body ());
You can’t perform that action at this time.
0 commit comments