rebase correctly

This commit is contained in:
Christian Schabesberger 2018-11-09 19:55:40 +01:00
parent b40a1f3657
commit a78ad16235
3 changed files with 8 additions and 44 deletions

View file

@ -1,7 +1,7 @@
package org.schabi.newpipe.extractor.stream; 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 <chris.schabesberger@mailbox.org> * Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
* StreamExtractor.java is part of NewPipe. * StreamExtractor.java is part of NewPipe.
@ -211,19 +211,20 @@ public abstract class StreamExtractor extends Extractor {
* @throws ExtractionException * @throws ExtractionException
*/ */
@Nonnull @Nonnull
public abstract List<Subtitles> getSubtitlesDefault() throws IOException, ExtractionException; public abstract List<SubtitlesStream> getSubtitlesDefault() throws IOException, ExtractionException;
/** /**
* This will return a list of available * This will return a list of available
* <a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/stream/Subtitles.html">Subtitles</a>s. * <a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/org/schabi/newpipe/extractor/stream/Subtitles.html">Subtitles</a>s.
* given by a specific type. * given by a specific type.
* If no subtitles in that specific format are available an empty list can returned. * 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 * @return a list of available subtitles or an empty list
* @throws IOException * @throws IOException
* @throws ExtractionException * @throws ExtractionException
*/ */
@Nonnull @Nonnull
public abstract List<Subtitles> getSubtitles(SubtitlesFormat format) throws IOException, ExtractionException; public abstract List<SubtitlesStream> getSubtitles(MediaFormat format) throws IOException, ExtractionException;
/** /**
* Get the <a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/">StreamType</a>. * Get the <a href="https://teamnewpipe.github.io/NewPipeExtractor/javadoc/">StreamType</a>.
@ -317,42 +318,4 @@ public abstract class StreamExtractor extends Extractor {
return 0; 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<AudioStream> getAudioStreams() throws IOException, ExtractionException;
public abstract List<VideoStream> getVideoStreams() throws IOException, ExtractionException;
public abstract List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionException;
@Nonnull
public abstract List<SubtitlesStream> getSubtitlesDefault() throws IOException, ExtractionException;
@Nonnull
public abstract List<SubtitlesStream> 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();
} }

View file

@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor.services.youtube;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.schabi.newpipe.Downloader; import org.schabi.newpipe.Downloader;
import org.schabi.newpipe.extractor.MediaFormat;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.exceptions.ExtractionException; import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
@ -164,7 +165,7 @@ public class YoutubeStreamExtractorDefaultTest {
@Test @Test
public void testGetSubtitlesList() throws IOException, ExtractionException { public void testGetSubtitlesList() throws IOException, ExtractionException {
// Video (/view?v=YQHsXMglC9A) set in the setUp() method has no captions => null // 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());
} }
} }

View file

@ -62,9 +62,9 @@ public class YoutubeSearchExtractorDefaultTest extends YoutubeSearchExtractorBas
@Test @Test
public void testResultList_FirstElement() { 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); assertTrue(firstInfoItem instanceof ChannelInfoItem);
assertEquals("name", "PewDiePie", firstInfoItem.getName()); assertEquals("name", "PewDiePie", firstInfoItem.getName());
assertEquals("url","https://www.youtube.com/user/PewDiePie", firstInfoItem.getUrl()); assertEquals("url","https://www.youtube.com/user/PewDiePie", firstInfoItem.getUrl());