21e542e7d2
- Refactor info classes and extractors - Reformat and fix indentation - Organize packages and classes - Rename variables/methods and fix regex - Change the capitalization - Add methods to playlist extractor
84 lines
2.7 KiB
Java
84 lines
2.7 KiB
Java
package org.schabi.newpipe.extractor.channel;
|
|
|
|
import org.schabi.newpipe.extractor.Info;
|
|
import org.schabi.newpipe.extractor.InfoItem;
|
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
|
import org.schabi.newpipe.extractor.stream.StreamInfoItemCollector;
|
|
|
|
import java.util.List;
|
|
|
|
/*
|
|
* 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/>.
|
|
*/
|
|
|
|
public class ChannelInfo extends Info {
|
|
|
|
public static ChannelInfo getInfo(ChannelExtractor extractor)
|
|
throws ParsingException {
|
|
ChannelInfo info = new ChannelInfo();
|
|
|
|
// important data
|
|
info.service_id = extractor.getServiceId();
|
|
info.url = extractor.getUrl();
|
|
info.name = extractor.getChannelName();
|
|
info.hasMoreStreams = extractor.hasMoreStreams();
|
|
|
|
try {
|
|
info.id = extractor.getChannelId();
|
|
} catch (Exception e) {
|
|
info.errors.add(e);
|
|
}
|
|
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();
|
|
} catch (Exception e) {
|
|
info.errors.add(e);
|
|
}
|
|
try {
|
|
StreamInfoItemCollector c = extractor.getStreams();
|
|
info.related_streams = c.getItemList();
|
|
info.errors.addAll(c.getErrors());
|
|
} catch (Exception e) {
|
|
info.errors.add(e);
|
|
}
|
|
try {
|
|
info.subscriber_count = extractor.getSubscriberCount();
|
|
} 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;
|
|
public long subscriber_count = -1;
|
|
public boolean hasMoreStreams = false;
|
|
}
|