[Bandcamp] Upgrade incoming links to HTTPS
This commit is contained in:
parent
02e14b8931
commit
f441036ed2
|
@ -16,6 +16,7 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
||||||
import org.schabi.newpipe.extractor.localization.DateWrapper;
|
import org.schabi.newpipe.extractor.localization.DateWrapper;
|
||||||
import org.schabi.newpipe.extractor.utils.ImageSuffix;
|
import org.schabi.newpipe.extractor.utils.ImageSuffix;
|
||||||
|
import org.schabi.newpipe.extractor.utils.Utils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
@ -171,7 +172,11 @@ public final class BandcampExtractorHelper {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Test other URLs for whether they contain a footer that links to bandcamp
|
// Test other URLs for whether they contain a footer that links to bandcamp
|
||||||
return Jsoup.parse(NewPipe.getDownloader().get(url).responseBody())
|
return Jsoup.parse(
|
||||||
|
NewPipe.getDownloader()
|
||||||
|
.get(Utils.replaceHttpWithHttps(url))
|
||||||
|
.responseBody()
|
||||||
|
)
|
||||||
.getElementsByClass("cart-wrapper")
|
.getElementsByClass("cart-wrapper")
|
||||||
.get(0)
|
.get(0)
|
||||||
.getElementsByTag("a")
|
.getElementsByTag("a")
|
||||||
|
|
|
@ -33,7 +33,8 @@ public final class BandcampChannelLinkHandlerFactory extends ListLinkHandlerFact
|
||||||
@Override
|
@Override
|
||||||
public String getId(final String url) throws ParsingException, UnsupportedOperationException {
|
public String getId(final String url) throws ParsingException, UnsupportedOperationException {
|
||||||
try {
|
try {
|
||||||
final String response = NewPipe.getDownloader().get(url).responseBody();
|
final String response = NewPipe.getDownloader().get(Utils.replaceHttpWithHttps(url))
|
||||||
|
.responseBody();
|
||||||
|
|
||||||
// Use band data embedded in website to extract ID
|
// Use band data embedded in website to extract ID
|
||||||
final JsonObject bandData = JsonUtils.getJsonData(response, "data-band");
|
final JsonObject bandData = JsonUtils.getJsonData(response, "data-band");
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor.services.bandcamp.linkHandler;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
|
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
|
||||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper;
|
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper;
|
||||||
|
import org.schabi.newpipe.extractor.utils.Utils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ public final class BandcampCommentsLinkHandlerFactory extends ListLinkHandlerFac
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId(final String url) throws ParsingException, UnsupportedOperationException {
|
public String getId(final String url) throws ParsingException, UnsupportedOperationException {
|
||||||
return url;
|
return Utils.replaceHttpWithHttps(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,6 +48,6 @@ public final class BandcampCommentsLinkHandlerFactory extends ListLinkHandlerFac
|
||||||
final List<String> contentFilter,
|
final List<String> contentFilter,
|
||||||
final String sortFilter)
|
final String sortFilter)
|
||||||
throws ParsingException, UnsupportedOperationException {
|
throws ParsingException, UnsupportedOperationException {
|
||||||
return id;
|
return Utils.replaceHttpWithHttps(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ package org.schabi.newpipe.extractor.services.bandcamp.linkHandler;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
|
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
|
||||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper;
|
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper;
|
||||||
|
import org.schabi.newpipe.extractor.utils.Utils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ public final class BandcampPlaylistLinkHandlerFactory extends ListLinkHandlerFac
|
||||||
final List<String> contentFilter,
|
final List<String> contentFilter,
|
||||||
final String sortFilter)
|
final String sortFilter)
|
||||||
throws ParsingException, UnsupportedOperationException {
|
throws ParsingException, UnsupportedOperationException {
|
||||||
return url;
|
return Utils.replaceHttpWithHttps(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,7 @@ package org.schabi.newpipe.extractor.services.bandcamp.linkHandler;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
|
import org.schabi.newpipe.extractor.linkhandler.LinkHandlerFactory;
|
||||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper;
|
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper;
|
||||||
|
import org.schabi.newpipe.extractor.utils.Utils;
|
||||||
|
|
||||||
import static org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper.BASE_URL;
|
import static org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampExtractorHelper.BASE_URL;
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ public final class BandcampStreamLinkHandlerFactory extends LinkHandlerFactory {
|
||||||
if (input.matches("\\d+")) {
|
if (input.matches("\\d+")) {
|
||||||
return BASE_URL + "/?show=" + input;
|
return BASE_URL + "/?show=" + input;
|
||||||
} else {
|
} else {
|
||||||
return input;
|
return Utils.replaceHttpWithHttps(input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue