Skip to content

Commit 7cfdaf3

Browse files
committed
Fix relative url in uploader URL
1 parent 06ea74c commit 7cfdaf3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamInfoItemExtractor.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,23 @@ public String getUploaderName() throws ParsingException {
9494
}
9595
}
9696

97+
private static String fixRelativeUrls(String url) {
98+
if(url == null || url.isEmpty()) return url;
99+
if(url.startsWith("/")) {
100+
return "https://youtube.com" + url;
101+
} else {
102+
return url;
103+
}
104+
}
105+
97106
@Override
98107
public String getUploaderUrl() throws ParsingException {
99108
try {
100109
try {
101-
return item.select("div[class=\"yt-lockup-byline\"]").first()
110+
String url = item.select("div[class=\"yt-lockup-byline\"]").first()
102111
.select("a").first()
103112
.attr("href");
113+
return fixRelativeUrls(url);
104114
} catch (Exception e){}
105115

106116
// try this if the first didn't work

0 commit comments

Comments
 (0)