2017-03-01 17:47:52 +00:00
|
|
|
package org.schabi.newpipe.extractor.channel;
|
|
|
|
|
2017-06-29 18:12:55 +00:00
|
|
|
import org.schabi.newpipe.extractor.Info;
|
2017-03-01 17:47:52 +00:00
|
|
|
import org.schabi.newpipe.extractor.InfoItem;
|
|
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
2017-06-29 18:12:55 +00:00
|
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItemCollector;
|
2017-03-01 17:47:52 +00:00
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2017-06-29 18:12:55 +00:00
|
|
|
/*
|
2017-03-01 17:47:52 +00:00
|
|
|
* Created by Christian Schabesberger on 31.07.16.
|
|
|
|
*
|
|
|
|
* Copyright (C) Christian Schabesberger 2016 <chris.schabesberger@mailbox.org>
|
|
|
|
* ChannelInfo.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 18:12:55 +00:00
|
|
|
public class ChannelInfo extends Info {
|
2017-03-01 17:47:52 +00:00
|
|
|
|
|
|
|
public static ChannelInfo getInfo(ChannelExtractor extractor)
|
2017-06-29 18:12:55 +00:00
|
|
|
throws ParsingException {
|
2017-03-01 17:47:52 +00:00
|
|
|
ChannelInfo info = new ChannelInfo();
|
|
|
|
|
2017-06-29 17:34:21 +00:00
|
|
|
// important data
|
2017-03-01 17:47:52 +00:00
|
|
|
info.service_id = extractor.getServiceId();
|
2017-06-29 18:12:55 +00:00
|
|
|
info.url = extractor.getUrl();
|
|
|
|
info.name = extractor.getChannelName();
|
|
|
|
info.hasMoreStreams = extractor.hasMoreStreams();
|
2017-03-01 17:47:52 +00:00
|
|
|
|
2017-06-29 18:12:55 +00:00
|
|
|
try {
|
|
|
|
info.id = extractor.getChannelId();
|
|
|
|
} catch (Exception e) {
|
|
|
|
info.errors.add(e);
|
|
|
|
}
|
2017-03-01 17:47:52 +00:00
|
|
|
try {
|
|
|
|
info.avatar_url = extractor.getAvatarUrl();
|
|
|
|
} catch (Exception e) {
|
|
|
|
info.errors.add(e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
info.banner_url = extractor.getBannerUrl();
|
|
|
|
} catch (Exception e) {
|
|
|
|
info.errors.add(e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
info.feed_url = extractor.getFeedUrl();
|
2017-06-29 18:12:55 +00:00
|
|
|
} catch (Exception e) {
|
2017-03-01 17:47:52 +00:00
|
|
|
info.errors.add(e);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
StreamInfoItemCollector c = extractor.getStreams();
|
|
|
|
info.related_streams = c.getItemList();
|
|
|
|
info.errors.addAll(c.getErrors());
|
2017-06-29 18:12:55 +00:00
|
|
|
} catch (Exception e) {
|
2017-03-01 17:47:52 +00:00
|
|
|
info.errors.add(e);
|
|
|
|
}
|
|
|
|
try {
|
2017-06-29 18:12:55 +00:00
|
|
|
info.subscriber_count = extractor.getSubscriberCount();
|
2017-03-01 17:47:52 +00:00
|
|
|
} catch (Exception e) {
|
|
|
|
info.errors.add(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String avatar_url = "";
|
|
|
|
public String banner_url = "";
|
|
|
|
public String feed_url = "";
|
|
|
|
public List<InfoItem> related_streams = null;
|
2017-06-29 18:12:55 +00:00
|
|
|
public long subscriber_count = -1;
|
|
|
|
public boolean hasMoreStreams = false;
|
2017-03-01 17:47:52 +00:00
|
|
|
}
|