Bandcmap channel extractor: fix getting banner url

This commit is contained in:
Fynn Godau 2019-12-22 01:05:34 +01:00
parent 7730eb2ea1
commit d5cdc20be1
2 changed files with 10 additions and 2 deletions

View File

@ -4,7 +4,7 @@ package org.schabi.newpipe.extractor.services.bandcamp.extractors;
import org.json.JSONArray;
import org.json.JSONObject;
import org.jsoup.nodes.Document;
import org.jsoup.Jsoup;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.channel.ChannelExtractor;
@ -74,8 +74,10 @@ public class BandcampChannelExtractor extends ChannelExtractor {
String html = getDownloader().get(channelInfo.getString("bandcamp_url").replace("http://", "https://"))
.responseBody();
return new Document(html).getElementById("customHeader")
return Jsoup.parse(html)
.getElementById("customHeader")
.getElementsByTag("img")
.first()
.attr("src");
} catch (IOException | ReCaptchaException e) {

View File

@ -39,4 +39,10 @@ public class BandcampChannelExtractorTest {
public void testLength() throws ParsingException {
assertTrue(extractor.getInitialPage().getItems().size() > 2);
}
@Test
public void testGetBannerUrl() throws ParsingException {
// Why is this picture in png format when all other pictures are jpg?
assertTrue(extractor.getBannerUrl().endsWith(".png"));
}
}