Code improvements
This commit is contained in:
parent
98268e351c
commit
fa61b864f2
|
@ -43,7 +43,7 @@ public class BandcampExtractorHelper {
|
|||
|
||||
/**
|
||||
* Translate all these parameters together to the URL of the corresponding album or track
|
||||
* using the mobile api
|
||||
* using the mobile API
|
||||
*/
|
||||
public static String getStreamUrlFromIds(final long bandId, final long itemId, final String itemType)
|
||||
throws ParsingException {
|
||||
|
@ -51,7 +51,7 @@ public class BandcampExtractorHelper {
|
|||
try {
|
||||
final String jsonString = NewPipe.getDownloader().get(
|
||||
"https://bandcamp.com/api/mobile/22/tralbum_details?band_id=" + bandId
|
||||
+ "&tralbum_id=" + itemId + "&tralbum_type=" + itemType.substring(0, 1))
|
||||
+ "&tralbum_id=" + itemId + "&tralbum_type=" + itemType.charAt(0))
|
||||
.responseBody();
|
||||
|
||||
return JsonParser.object().from(jsonString).getString("bandcamp_url").replace("http://", "https://");
|
||||
|
@ -88,7 +88,7 @@ public class BandcampExtractorHelper {
|
|||
|
||||
}
|
||||
|
||||
return String.valueOf(result);
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@ import static org.schabi.newpipe.extractor.services.bandcamp.extractors.Bandcamp
|
|||
|
||||
public class BandcampRadioInfoItemExtractor implements StreamInfoItemExtractor {
|
||||
|
||||
private JsonObject show;
|
||||
private final JsonObject show;
|
||||
|
||||
public BandcampRadioInfoItemExtractor(final JsonObject radioShow) {
|
||||
show = radioShow;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class BandcampSuggestionExtractor extends SuggestionExtractor {
|
|||
final JsonArray jsonArray = fuzzyResults.getObject("auto")
|
||||
.getArray("results");
|
||||
|
||||
final ArrayList<String> suggestions = new ArrayList<>();
|
||||
final List<String> suggestions = new ArrayList<>();
|
||||
|
||||
for (final Object fuzzyResult : jsonArray) {
|
||||
final String res = ((JsonObject) fuzzyResult).getString("name");
|
||||
|
@ -52,6 +52,5 @@ public class BandcampSuggestionExtractor extends SuggestionExtractor {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,5 +48,6 @@ public class BandcampStreamLinkHandlerFactoryTest {
|
|||
assertTrue(linkHandler.acceptUrl("http://ZachBenson.Bandcamp.COM/Track/U-I-Tonite/"));
|
||||
assertTrue(linkHandler.acceptUrl("https://interovgm.com/track/title"));
|
||||
assertTrue(linkHandler.acceptUrl("http://bandcamP.com/?show=38"));
|
||||
assertTrue(linkHandler.acceptUrl("https://goodgoodblood-tl.bandcamp.com/track/when-it-all-wakes-up"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue