diff --git a/AbstractStreamInfo.java b/AbstractStreamInfo.java index bfa86b3f7..1b159d276 100644 --- a/AbstractStreamInfo.java +++ b/AbstractStreamInfo.java @@ -18,8 +18,10 @@ package org.schabi.newpipe.extractor; * along with NewPipe. If not, see . */ +import java.io.Serializable; + /**Common properties between StreamInfo and StreamInfoItem.*/ -public abstract class AbstractStreamInfo { +public abstract class AbstractStreamInfo implements Serializable{ public enum StreamType { NONE, // placeholder to check if stream type was checked or not VIDEO_STREAM, diff --git a/InfoItem.java b/InfoItem.java index a3395e8e4..1e9c2dd5a 100644 --- a/InfoItem.java +++ b/InfoItem.java @@ -1,5 +1,7 @@ package org.schabi.newpipe.extractor; +import java.io.Serializable; + /** * Created by the-scrabi on 11.02.17. * @@ -20,7 +22,7 @@ package org.schabi.newpipe.extractor; * along with NewPipe. If not, see . */ -public interface InfoItem { +public interface InfoItem extends Serializable{ public enum InfoType { STREAM, PLAYLIST, diff --git a/channel/ChannelInfo.java b/channel/ChannelInfo.java index e1fd96ada..326c512b9 100644 --- a/channel/ChannelInfo.java +++ b/channel/ChannelInfo.java @@ -2,9 +2,9 @@ package org.schabi.newpipe.extractor.channel; import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.exceptions.ParsingException; -import org.schabi.newpipe.extractor.stream_info.StreamInfoItem; import org.schabi.newpipe.extractor.stream_info.StreamInfoItemCollector; +import java.io.Serializable; import java.util.List; import java.util.Vector; @@ -28,7 +28,7 @@ import java.util.Vector; * along with NewPipe. If not, see . */ -public class ChannelInfo { +public class ChannelInfo implements Serializable{ public void addException(Exception e) { errors.add(e); } diff --git a/services/youtube/YoutubeChannelExtractor.java b/services/youtube/YoutubeChannelExtractor.java index 0b8fda717..b71fcffdb 100644 --- a/services/youtube/YoutubeChannelExtractor.java +++ b/services/youtube/YoutubeChannelExtractor.java @@ -18,7 +18,6 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.stream_info.StreamInfoItemCollector; import org.schabi.newpipe.extractor.stream_info.StreamInfoItemExtractor; - import java.io.IOException; /** @@ -46,19 +45,20 @@ public class YoutubeChannelExtractor extends ChannelExtractor { private static final String TAG = YoutubeChannelExtractor.class.toString(); // private CSSOMParser cssParser = new CSSOMParser(new SACParserCSS3()); + private static final String CHANNEL_FEED_BASE = "https://www.youtube.com/feeds/videos.xml?channel_id="; private Document doc = null; private boolean isAjaxPage = false; - private static String userUrl = ""; - private static String channelName = ""; - private static String avatarUrl = ""; - private static String bannerUrl = ""; - private static String feedUrl = ""; - private static long subscriberCount = -1; + private String userUrl = ""; + private String channelName = ""; + private String avatarUrl = ""; + private String bannerUrl = ""; + private String feedUrl = ""; + private long subscriberCount = -1; // the fist page is html all other pages are ajax. Every new page can be requested by sending // this request url. - private static String nextPageUrl = ""; + private String nextPageUrl = ""; public YoutubeChannelExtractor(UrlIdHandler urlIdHandler, String url, int page, int serviceId) throws ExtractionException, IOException { @@ -318,13 +318,8 @@ public class YoutubeChannelExtractor extends ChannelExtractor { @Override public String getFeedUrl() throws ParsingException { try { - if(userUrl.contains("channel")) { - //channels don't have feeds in youtube, only user can provide such - return ""; - } - if(!isAjaxPage) { - feedUrl = doc.select("link[title=\"RSS\"]").first().attr("abs:href"); - } + String channelId = doc.getElementsByClass("yt-uix-subscription-button").first().attr("data-channel-external-id"); + feedUrl = CHANNEL_FEED_BASE + channelId; return feedUrl; } catch(Exception e) { throw new ParsingException("Could not get feed url", e); diff --git a/services/youtube/YoutubePlayListExtractor.java b/services/youtube/YoutubePlayListExtractor.java index 2ada1c7ff..6e7c2e39f 100644 --- a/services/youtube/YoutubePlayListExtractor.java +++ b/services/youtube/YoutubePlayListExtractor.java @@ -25,11 +25,11 @@ public class YoutubePlayListExtractor extends PlayListExtractor { private Document doc = null; private boolean isAjaxPage = false; - private static String name = ""; - private static String feedUrl = ""; - private static String avatarUrl = ""; - private static String bannerUrl = ""; - private static String nextPageUrl = ""; + private String name = ""; + private String feedUrl = ""; + private String avatarUrl = ""; + private String bannerUrl = ""; + private String nextPageUrl = ""; public YoutubePlayListExtractor(UrlIdHandler urlIdHandler, String url, int page, int serviceId) throws IOException, ExtractionException {