|
| 1 | +package org.schabi.newpipe.extractor.services.youtube.search; |
| 2 | + |
| 3 | +import org.junit.BeforeClass; |
| 4 | +import org.junit.Test; |
| 5 | +import org.schabi.newpipe.Downloader; |
| 6 | +import org.schabi.newpipe.extractor.InfoItem; |
| 7 | +import org.schabi.newpipe.extractor.NewPipe; |
| 8 | +import org.schabi.newpipe.extractor.channel.ChannelInfoItem; |
| 9 | +import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeSearchExtractor; |
| 10 | +import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory; |
| 11 | + |
| 12 | +import static java.util.Collections.singletonList; |
| 13 | +import static junit.framework.TestCase.assertTrue; |
| 14 | +import static org.schabi.newpipe.extractor.ServiceList.YouTube; |
| 15 | + |
| 16 | +public class YoutubeSearchCountTest { |
| 17 | + public static class YoutubeChannelViewCountTest extends YoutubeSearchExtractorBaseTest { |
| 18 | + @BeforeClass |
| 19 | + public static void setUpClass() throws Exception { |
| 20 | + NewPipe.init(Downloader.getInstance()); |
| 21 | + extractor = (YoutubeSearchExtractor) YouTube.getSearchExtractor("pewdiepie", |
| 22 | + singletonList(YoutubeSearchQueryHandlerFactory.CHANNELS), null,"de"); |
| 23 | + extractor.fetchPage(); |
| 24 | + itemsPage = extractor.getInitialPage(); |
| 25 | + } |
| 26 | + |
| 27 | + @Test |
| 28 | + public void testViewCount() throws Exception { |
| 29 | + boolean foundKnownChannel = false; |
| 30 | + ChannelInfoItem ci = (ChannelInfoItem) itemsPage.getItems().get(0); |
| 31 | + assertTrue("Count does not fit: " + Long.toString(ci.getSubscriberCount()), |
| 32 | + 65043316 < ci.getSubscriberCount() && ci.getSubscriberCount() < 68043316); |
| 33 | + } |
| 34 | + } |
| 35 | +} |
0 commit comments