Use 'abs:' prefix
This commit is contained in:
parent
7cfdaf39a4
commit
978a33fae2
|
@ -265,7 +265,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
|
|||
|
||||
@Override
|
||||
public String getUploaderUrl() throws ParsingException {
|
||||
return getUploaderLink().attr("href");
|
||||
return getUploaderLink().attr("abs:href");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -94,23 +94,13 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
|
|||
}
|
||||
}
|
||||
|
||||
private static String fixRelativeUrls(String url) {
|
||||
if(url == null || url.isEmpty()) return url;
|
||||
if(url.startsWith("/")) {
|
||||
return "https://youtube.com" + url;
|
||||
} else {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploaderUrl() throws ParsingException {
|
||||
try {
|
||||
try {
|
||||
String url = item.select("div[class=\"yt-lockup-byline\"]").first()
|
||||
return item.select("div[class=\"yt-lockup-byline\"]").first()
|
||||
.select("a").first()
|
||||
.attr("href");
|
||||
return fixRelativeUrls(url);
|
||||
.attr("abs:href");
|
||||
} catch (Exception e){}
|
||||
|
||||
// try this if the first didn't work
|
||||
|
|
|
@ -110,7 +110,7 @@ public class YoutubeTrendingExtractor extends KioskExtractor {
|
|||
@Override
|
||||
public String getUploaderUrl() throws ParsingException {
|
||||
try {
|
||||
String link = getUploaderLink().attr("href");
|
||||
String link = getUploaderLink().attr("abs:href");
|
||||
if (link.isEmpty()) {
|
||||
throw new IllegalArgumentException("is empty");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue