mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-29 00:10:35 +05:30
[YouTube] Fix getting the comment text if the comment contains a hashtag
This commit is contained in:
parent
999fb7f812
commit
3f7df9536e
@ -845,6 +845,14 @@ public final class YoutubeParsingHelper {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public static String getUrlFromNavigationEndpoint(@Nonnull final JsonObject navigationEndpoint)
|
public static String getUrlFromNavigationEndpoint(@Nonnull final JsonObject navigationEndpoint)
|
||||||
throws ParsingException {
|
throws ParsingException {
|
||||||
|
if (navigationEndpoint.has("webCommandMetadata")) {
|
||||||
|
// this case needs to be handled before the browseEndpoint,
|
||||||
|
// e.g. for hashtags in comments
|
||||||
|
final JsonObject metadata = navigationEndpoint.getObject("webCommandMetadata");
|
||||||
|
if (metadata.has("url")) {
|
||||||
|
return "https://www.youtube.com" + metadata.getString("url");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (navigationEndpoint.has("urlEndpoint")) {
|
if (navigationEndpoint.has("urlEndpoint")) {
|
||||||
String internUrl = navigationEndpoint.getObject("urlEndpoint").getString("url");
|
String internUrl = navigationEndpoint.getObject("urlEndpoint").getString("url");
|
||||||
if (internUrl.startsWith("https://www.youtube.com/redirect?")) {
|
if (internUrl.startsWith("https://www.youtube.com/redirect?")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user