2017-06-29 20:12:55 +02:00
|
|
|
package org.schabi.newpipe.extractor.stream;
|
2017-03-01 18:47:52 +01:00
|
|
|
|
2017-06-29 20:12:55 +02:00
|
|
|
/*
|
2017-03-01 18:47:52 +01:00
|
|
|
* Created by Christian Schabesberger on 10.08.15.
|
|
|
|
*
|
|
|
|
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
|
|
|
* StreamExtractor.java is part of NewPipe.
|
|
|
|
*
|
|
|
|
* NewPipe is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* NewPipe is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2017-06-29 20:12:55 +02:00
|
|
|
import org.schabi.newpipe.extractor.Extractor;
|
2017-08-06 22:20:15 +02:00
|
|
|
import org.schabi.newpipe.extractor.StreamingService;
|
2017-03-01 18:47:52 +01:00
|
|
|
import org.schabi.newpipe.extractor.UrlIdHandler;
|
2017-08-06 22:20:15 +02:00
|
|
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
2017-03-01 18:47:52 +01:00
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
|
|
|
2017-08-04 16:21:45 +02:00
|
|
|
import java.io.IOException;
|
2017-03-01 18:47:52 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
2017-06-29 20:12:55 +02:00
|
|
|
/**
|
|
|
|
* Scrapes information from a video streaming service (eg, YouTube).
|
|
|
|
*/
|
|
|
|
public abstract class StreamExtractor extends Extractor {
|
2017-03-01 18:47:52 +01:00
|
|
|
|
2017-08-06 22:20:15 +02:00
|
|
|
public StreamExtractor(StreamingService service, String url) throws IOException, ExtractionException {
|
|
|
|
super(service, url);
|
|
|
|
fetchPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected UrlIdHandler getUrlIdHandler() throws ParsingException {
|
|
|
|
return getService().getStreamUrlIdHandler();
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
2017-07-11 05:08:03 +02:00
|
|
|
public abstract String getId() throws ParsingException;
|
2017-03-01 18:47:52 +01:00
|
|
|
public abstract int getTimeStamp() throws ParsingException;
|
|
|
|
public abstract String getTitle() throws ParsingException;
|
|
|
|
public abstract String getDescription() throws ParsingException;
|
2017-08-08 23:36:11 +02:00
|
|
|
public abstract String getUploaderName() throws ParsingException;
|
|
|
|
public abstract String getUploaderUrl() throws ParsingException;
|
2017-03-01 18:47:52 +01:00
|
|
|
public abstract int getLength() throws ParsingException;
|
|
|
|
public abstract long getViewCount() throws ParsingException;
|
|
|
|
public abstract String getUploadDate() throws ParsingException;
|
|
|
|
public abstract String getThumbnailUrl() throws ParsingException;
|
2017-08-08 23:36:11 +02:00
|
|
|
public abstract String getUploaderAvatarUrl() throws ParsingException;
|
2017-08-06 22:20:15 +02:00
|
|
|
public abstract List<AudioStream> getAudioStreams() throws IOException, ExtractionException;
|
|
|
|
public abstract List<VideoStream> getVideoStreams() throws IOException, ExtractionException;
|
|
|
|
public abstract List<VideoStream> getVideoOnlyStreams() throws IOException, ExtractionException;
|
2017-03-01 18:47:52 +01:00
|
|
|
public abstract String getDashMpdUrl() throws ParsingException;
|
|
|
|
public abstract int getAgeLimit() throws ParsingException;
|
|
|
|
public abstract int getLikeCount() throws ParsingException;
|
|
|
|
public abstract int getDislikeCount() throws ParsingException;
|
2017-08-06 22:20:15 +02:00
|
|
|
public abstract StreamInfoItemExtractor getNextVideo() throws IOException, ExtractionException;
|
|
|
|
public abstract StreamInfoItemCollector getRelatedVideos() throws IOException, ExtractionException;
|
2017-07-11 05:08:03 +02:00
|
|
|
public abstract StreamType getStreamType() throws ParsingException;
|
2017-05-27 14:23:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Analyses the webpage's document and extracts any error message there might be.
|
|
|
|
*
|
2017-08-06 22:20:15 +02:00
|
|
|
* @return Error message; null if there is no error message.
|
2017-05-27 14:23:48 +02:00
|
|
|
*/
|
|
|
|
public abstract String getErrorMessage();
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|