Skip to content

Commit 3f7df95

Browse files
committed
[YouTube] Fix getting the comment text if the comment contains a hashtag
1 parent 999fb7f commit 3f7df95

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,14 @@ public static String[] getYoutubeMusicKey()
845845
@Nullable
846846
public static String getUrlFromNavigationEndpoint(@Nonnull final JsonObject navigationEndpoint)
847847
throws ParsingException {
848+
if (navigationEndpoint.has("webCommandMetadata")) {
849+
// this case needs to be handled before the browseEndpoint,
850+
// e.g. for hashtags in comments
851+
final JsonObject metadata = navigationEndpoint.getObject("webCommandMetadata");
852+
if (metadata.has("url")) {
853+
return "https://www.youtube.com" + metadata.getString("url");
854+
}
855+
}
848856
if (navigationEndpoint.has("urlEndpoint")) {
849857
String internUrl = navigationEndpoint.getObject("urlEndpoint").getString("url");
850858
if (internUrl.startsWith("https://www.youtube.com/redirect?")) {

0 commit comments

Comments
 (0)