Fix getting uploader for videoRenderer
This commit is contained in:
parent
b88188d419
commit
957db062ef
|
@ -104,20 +104,37 @@ public class YoutubeStreamInfoItemExtractor implements StreamInfoItemExtractor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUploaderName() throws ParsingException {
|
public String getUploaderName() throws ParsingException {
|
||||||
|
String name = null;
|
||||||
try {
|
try {
|
||||||
return videoInfo.getObject("longBylineText").getArray("runs")
|
name = videoInfo.getObject("longBylineText").getArray("runs")
|
||||||
.getObject(0).getString("text");
|
.getObject(0).getString("text");
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {}
|
||||||
throw new ParsingException("Could not get uploader name", e);
|
if (name == null) {
|
||||||
|
try {
|
||||||
|
name = videoInfo.getObject("ownerText").getArray("runs")
|
||||||
|
.getObject(0).getString("text");
|
||||||
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
|
if (name != null && !name.isEmpty()) return name;
|
||||||
|
throw new ParsingException("Could not get uploader name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUploaderUrl() throws ParsingException {
|
public String getUploaderUrl() throws ParsingException {
|
||||||
try {
|
try {
|
||||||
String id = videoInfo.getObject("longBylineText").getArray("runs")
|
String id = null;
|
||||||
|
try {
|
||||||
|
id = videoInfo.getObject("longBylineText").getArray("runs")
|
||||||
.getObject(0).getObject("navigationEndpoint")
|
.getObject(0).getObject("navigationEndpoint")
|
||||||
.getObject("browseEndpoint").getString("browseId");
|
.getObject("browseEndpoint").getString("browseId");
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
if (id == null) {
|
||||||
|
try {
|
||||||
|
id = videoInfo.getObject("ownerText").getArray("runs")
|
||||||
|
.getObject(0).getObject("navigationEndpoint")
|
||||||
|
.getObject("browseEndpoint").getString("browseId");
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
}
|
||||||
if (id == null || id.isEmpty()) {
|
if (id == null || id.isEmpty()) {
|
||||||
throw new IllegalArgumentException("is empty");
|
throw new IllegalArgumentException("is empty");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue