Skip to content

Commit 5907c35

Browse files
committed
Revert some changes
1 parent afef926 commit 5907c35

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

services/youtube/YoutubeChannelExtractor.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.schabi.newpipe.extractor.stream_info.StreamInfoItemCollector;
1919
import org.schabi.newpipe.extractor.stream_info.StreamInfoItemExtractor;
2020

21+
2122
import java.io.IOException;
2223

2324
/**
@@ -45,20 +46,19 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
4546
private static final String TAG = YoutubeChannelExtractor.class.toString();
4647

4748
// private CSSOMParser cssParser = new CSSOMParser(new SACParserCSS3());
48-
private static final String CHANNEL_FEED_BASE = "https://www.youtube.com/feeds/videos.xml?channel_id=";
4949

5050
private Document doc = null;
5151

5252
private boolean isAjaxPage = false;
53-
private String userUrl = "";
54-
private String channelName = "";
55-
private String avatarUrl = "";
56-
private String bannerUrl = "";
57-
private String feedUrl = "";
58-
private long subscriberCount = -1;
53+
private static String userUrl = "";
54+
private static String channelName = "";
55+
private static String avatarUrl = "";
56+
private static String bannerUrl = "";
57+
private static String feedUrl = "";
58+
private static long subscriberCount = -1;
5959
// the fist page is html all other pages are ajax. Every new page can be requested by sending
6060
// this request url.
61-
private String nextPageUrl = "";
61+
private static String nextPageUrl = "";
6262

6363
public YoutubeChannelExtractor(UrlIdHandler urlIdHandler, String url, int page, int serviceId)
6464
throws ExtractionException, IOException {
@@ -318,8 +318,13 @@ public long getSubscriberCount() throws ParsingException {
318318
@Override
319319
public String getFeedUrl() throws ParsingException {
320320
try {
321-
String channelId = doc.getElementsByClass("yt-uix-subscription-button").first().attr("data-channel-external-id");
322-
feedUrl = CHANNEL_FEED_BASE + channelId;
321+
if(userUrl.contains("channel")) {
322+
//channels don't have feeds in youtube, only user can provide such
323+
return "";
324+
}
325+
if(!isAjaxPage) {
326+
feedUrl = doc.select("link[title=\"RSS\"]").first().attr("abs:href");
327+
}
323328
return feedUrl;
324329
} catch(Exception e) {
325330
throw new ParsingException("Could not get feed url", e);

services/youtube/YoutubePlayListExtractor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public class YoutubePlayListExtractor extends PlayListExtractor {
2525
private Document doc = null;
2626

2727
private boolean isAjaxPage = false;
28-
private String name = "";
29-
private String feedUrl = "";
30-
private String avatarUrl = "";
31-
private String bannerUrl = "";
32-
private String nextPageUrl = "";
28+
private static String name = "";
29+
private static String feedUrl = "";
30+
private static String avatarUrl = "";
31+
private static String bannerUrl = "";
32+
private static String nextPageUrl = "";
3333

3434
public YoutubePlayListExtractor(UrlIdHandler urlIdHandler,
3535
String url, int page, int serviceId) throws IOException, ExtractionException {

0 commit comments

Comments
 (0)