From a78ad162355d1e25b5646ed36319fb5c241abca3 Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Fri, 9 Nov 2018 19:55:40 +0100 Subject: [PATCH] rebase correctly --- .../extractor/stream/StreamExtractor.java | 45 ++----------------- .../YoutubeStreamExtractorDefaultTest.java | 3 +- .../YoutubeSearchExtractorDefaultTest.java | 4 +- 3 files changed, 8 insertions(+), 44 deletions(-) diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java index 7d1a5e69..3b9f0653 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/StreamExtractor.java @@ -1,7 +1,7 @@ package org.schabi.newpipe.extractor.stream; /* - * Created by Christian Schabesberger on 10.08.15. + * Created by Christian Schabesberger on 10.08.18. * * Copyright (C) Christian Schabesberger 2016 * StreamExtractor.java is part of NewPipe. @@ -211,19 +211,20 @@ public abstract class StreamExtractor extends Extractor { * @throws ExtractionException */ @Nonnull - public abstract List getSubtitlesDefault() throws IOException, ExtractionException; + public abstract List getSubtitlesDefault() throws IOException, ExtractionException; /** * This will return a list of available * Subtitless. * given by a specific type. * If no subtitles in that specific format are available an empty list can returned. + * @param format the media format by which the subtitles should be filtered * @return a list of available subtitles or an empty list * @throws IOException * @throws ExtractionException */ @Nonnull - public abstract List getSubtitles(SubtitlesFormat format) throws IOException, ExtractionException; + public abstract List getSubtitles(MediaFormat format) throws IOException, ExtractionException; /** * Get the StreamType. @@ -317,42 +318,4 @@ public abstract class StreamExtractor extends Extractor { return 0; } } - - public abstract long getViewCount() throws ParsingException; - public abstract long getLikeCount() throws ParsingException; - public abstract long getDislikeCount() throws ParsingException; - - @Nonnull - public abstract String getUploaderUrl() throws ParsingException; - @Nonnull - public abstract String getUploaderName() throws ParsingException; - @Nonnull - public abstract String getUploaderAvatarUrl() throws ParsingException; - - /** - * Get the dash mpd url - * @return the url as a string or an empty string - * @throws ParsingException if an error occurs while reading - */ - @Nonnull public abstract String getDashMpdUrl() throws ParsingException; - @Nonnull public abstract String getHlsUrl() throws ParsingException; - public abstract List getAudioStreams() throws IOException, ExtractionException; - public abstract List getVideoStreams() throws IOException, ExtractionException; - public abstract List getVideoOnlyStreams() throws IOException, ExtractionException; - - @Nonnull - public abstract List getSubtitlesDefault() throws IOException, ExtractionException; - @Nonnull - public abstract List getSubtitles(MediaFormat format) throws IOException, ExtractionException; - - public abstract StreamType getStreamType() throws ParsingException; - public abstract StreamInfoItem getNextVideo() throws IOException, ExtractionException; - public abstract StreamInfoItemsCollector getRelatedVideos() throws IOException, ExtractionException; - - /** - * Analyses the webpage's document and extracts any error message there might be. - * - * @return Error message; null if there is no error message. - */ - public abstract String getErrorMessage(); } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java index 75dc5e00..27b54c54 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractorDefaultTest.java @@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor.services.youtube; import org.junit.BeforeClass; import org.junit.Test; import org.schabi.newpipe.Downloader; +import org.schabi.newpipe.extractor.MediaFormat; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ParsingException; @@ -164,7 +165,7 @@ public class YoutubeStreamExtractorDefaultTest { @Test public void testGetSubtitlesList() throws IOException, ExtractionException { // Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null - assertTrue(extractor.getSubtitles(SubtitlesFormat.TTML).isEmpty()); + assertTrue(extractor.getSubtitles(MediaFormat.TTML).isEmpty()); } } diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorDefaultTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorDefaultTest.java index 172ca62c..3e7d3311 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorDefaultTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/youtube/search/YoutubeSearchExtractorDefaultTest.java @@ -62,9 +62,9 @@ public class YoutubeSearchExtractorDefaultTest extends YoutubeSearchExtractorBas @Test public void testResultList_FirstElement() { - InfoItem firstInfoItem = itemsPage.getItems().get(0); + InfoItem firstInfoItem = itemsPage.getItems().get(1); - // THe channel should be the first item + // The channel should be the first item assertTrue(firstInfoItem instanceof ChannelInfoItem); assertEquals("name", "PewDiePie", firstInfoItem.getName()); assertEquals("url","https://www.youtube.com/user/PewDiePie", firstInfoItem.getUrl());