Bandcamp search: multiple pages
This commit is contained in:
@@ -89,4 +89,17 @@ public class BandcampSearchExtractorTest {
|
||||
assertEquals(24, ((PlaylistInfoItem) minecraft).getStreamCount());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests searches with multiple pages
|
||||
*/
|
||||
@Test
|
||||
public void testMultiplePages() throws ExtractionException, IOException {
|
||||
// A query practically guaranteed to have the maximum amount of pages
|
||||
SearchExtractor extractor = bandcamp.getSearchExtractor("e");
|
||||
|
||||
assertEquals("https://bandcamp.com/search?q=e&page=2", extractor.getInitialPage().getNextPageUrl());
|
||||
|
||||
assertEquals("https://bandcamp.com/search?q=e&page=3", extractor.getPage(extractor.getNextPageUrl()).getNextPageUrl());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ public class BandcampSearchQueryHandlerFactoryTest {
|
||||
@Test
|
||||
public void testEncoding() throws ParsingException {
|
||||
// Note: this isn't exactly as bandcamp does it (it wouldn't encode '!'), but both works
|
||||
assertEquals("https://bandcamp.com/search?q=hello%21%22%C2%A7%24%25%26%2F%28%29%3D", searchQuery.getUrl("hello!\"§$%&/()="));
|
||||
assertEquals("https://bandcamp.com/search?q=hello%21%22%C2%A7%24%25%26%2F%28%29%3D&page=1", searchQuery.getUrl("hello!\"§$%&/()="));
|
||||
// Note: bandcamp uses %20 instead of '+', but both works
|
||||
assertEquals("https://bandcamp.com/search?q=search+query+with+spaces", searchQuery.getUrl("search query with spaces"));
|
||||
assertEquals("https://bandcamp.com/search?q=search+query+with+spaces&page=1", searchQuery.getUrl("search query with spaces"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user