mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2024-12-14 22:30:33 +05:30
Bandcamp: fix loading uploader from streams in search
This commit is contained in:
parent
3940138fc5
commit
de776561b0
@ -14,12 +14,14 @@ public class BandcampSearchStreamInfoItemExtractor extends BandcampStreamInfoIte
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUploaderName() throws ParsingException {
|
public String getUploaderName() {
|
||||||
String subhead = resultInfo.getElementsByClass("subhead").text();
|
String subhead = resultInfo.getElementsByClass("subhead").text();
|
||||||
String[] splitBy = subhead.split(" by");
|
String[] splitBy = subhead.split("by ");
|
||||||
if (splitBy.length > 1) {
|
if (splitBy.length > 1) {
|
||||||
return splitBy[1];
|
return splitBy[1];
|
||||||
} else throw new ParsingException("Uploader name was not found as expected");
|
} else {
|
||||||
|
return splitBy[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,6 +15,7 @@ import org.schabi.newpipe.extractor.search.SearchExtractor;
|
|||||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampChannelInfoItemExtractor;
|
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampChannelInfoItemExtractor;
|
||||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampPlaylistInfoItemExtractor;
|
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampPlaylistInfoItemExtractor;
|
||||||
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampSearchExtractor;
|
import org.schabi.newpipe.extractor.services.bandcamp.extractors.BandcampSearchExtractor;
|
||||||
|
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -44,10 +45,11 @@ public class BandcampSearchExtractorTest {
|
|||||||
SearchExtractor extractor = Bandcamp.getSearchExtractor("best friend's basement");
|
SearchExtractor extractor = Bandcamp.getSearchExtractor("best friend's basement");
|
||||||
|
|
||||||
ListExtractor.InfoItemsPage<InfoItem> page = extractor.getInitialPage();
|
ListExtractor.InfoItemsPage<InfoItem> page = extractor.getInitialPage();
|
||||||
InfoItem bestFriendsBasement = page.getItems().get(0);
|
StreamInfoItem bestFriendsBasement = (StreamInfoItem) page.getItems().get(0);
|
||||||
|
|
||||||
// The track by Zach Benson should be the first result, no?
|
// The track by Zach Benson should be the first result, no?
|
||||||
assertEquals("Best Friend's Basement", bestFriendsBasement.getName());
|
assertEquals("Best Friend's Basement", bestFriendsBasement.getName());
|
||||||
|
assertEquals("Zach Benson", bestFriendsBasement.getUploaderName());
|
||||||
assertTrue(bestFriendsBasement.getThumbnailUrl().endsWith(".jpg"));
|
assertTrue(bestFriendsBasement.getThumbnailUrl().endsWith(".jpg"));
|
||||||
assertTrue(bestFriendsBasement.getThumbnailUrl().contains("f4.bcbits.com/img/"));
|
assertTrue(bestFriendsBasement.getThumbnailUrl().contains("f4.bcbits.com/img/"));
|
||||||
assertEquals(InfoItem.InfoType.STREAM, bestFriendsBasement.getInfoType());
|
assertEquals(InfoItem.InfoType.STREAM, bestFriendsBasement.getInfoType());
|
||||||
|
Loading…
Reference in New Issue
Block a user