2017-03-01 18:47:52 +01:00
|
|
|
package org.schabi.newpipe.extractor.services.youtube;
|
|
|
|
|
|
|
|
import org.schabi.newpipe.extractor.StreamingService;
|
2017-06-29 20:12:55 +02:00
|
|
|
import org.schabi.newpipe.extractor.SuggestionExtractor;
|
2017-03-01 18:47:52 +01:00
|
|
|
import org.schabi.newpipe.extractor.UrlIdHandler;
|
|
|
|
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
|
2017-06-29 20:12:55 +02:00
|
|
|
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
|
2017-03-01 18:47:52 +01:00
|
|
|
import org.schabi.newpipe.extractor.search.SearchEngine;
|
2017-06-29 20:12:55 +02:00
|
|
|
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
2017-08-07 18:12:51 +02:00
|
|
|
import org.schabi.newpipe.extractor.user.UserExtractor;
|
2017-03-01 18:47:52 +01:00
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
|
2017-06-29 20:12:55 +02:00
|
|
|
/*
|
2017-03-01 18:47:52 +01:00
|
|
|
* Created by Christian Schabesberger on 23.08.15.
|
|
|
|
*
|
|
|
|
* Copyright (C) Christian Schabesberger 2015 <chris.schabesberger@mailbox.org>
|
|
|
|
* YoutubeService.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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class YoutubeService extends StreamingService {
|
|
|
|
|
2017-08-06 22:20:15 +02:00
|
|
|
public YoutubeService(int id, String name) {
|
|
|
|
super(id, name);
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-06 22:20:15 +02:00
|
|
|
public SearchEngine getSearchEngine() {
|
2017-07-11 05:08:03 +02:00
|
|
|
return new YoutubeSearchEngine(getServiceId());
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-06 22:20:15 +02:00
|
|
|
public UrlIdHandler getStreamUrlIdHandler() {
|
2017-03-01 18:47:52 +01:00
|
|
|
return YoutubeStreamUrlIdHandler.getInstance();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-07 18:12:51 +02:00
|
|
|
public UrlIdHandler getUserUrlIdHandler() {
|
|
|
|
return YoutubeUserUrlIdHandler.getInstance();
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
2017-03-12 16:15:51 +01:00
|
|
|
@Override
|
2017-08-06 22:20:15 +02:00
|
|
|
public UrlIdHandler getPlaylistUrlIdHandler() {
|
2017-07-11 05:08:03 +02:00
|
|
|
return YoutubePlaylistUrlIdHandler.getInstance();
|
2017-03-12 16:15:51 +01:00
|
|
|
}
|
|
|
|
|
2017-08-06 22:20:15 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public StreamExtractor getStreamExtractor(String url) throws IOException, ExtractionException {
|
|
|
|
return new YoutubeStreamExtractor(this, url);
|
|
|
|
}
|
|
|
|
|
2017-03-01 18:47:52 +01:00
|
|
|
@Override
|
2017-08-07 18:12:51 +02:00
|
|
|
public UserExtractor getUserExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException {
|
|
|
|
return new YoutubeUserExtractor(this, url, nextStreamsUrl);
|
2017-03-01 18:47:52 +01:00
|
|
|
}
|
|
|
|
|
2017-06-29 20:12:55 +02:00
|
|
|
@Override
|
2017-08-06 22:20:15 +02:00
|
|
|
public PlaylistExtractor getPlaylistExtractor(String url, String nextStreamsUrl) throws IOException, ExtractionException {
|
|
|
|
return new YoutubePlaylistExtractor(this, url, nextStreamsUrl);
|
2017-03-12 16:15:51 +01:00
|
|
|
}
|
|
|
|
|
2017-03-01 18:47:52 +01:00
|
|
|
@Override
|
2017-08-06 22:20:15 +02:00
|
|
|
public SuggestionExtractor getSuggestionExtractor() {
|
2017-03-01 18:47:52 +01:00
|
|
|
return new YoutubeSuggestionExtractor(getServiceId());
|
|
|
|
}
|
|
|
|
}
|