Skip to content

Commit

Permalink
Merge pull request #1021 from TeamNewPipe/fix/yt-comment-text-hashtag
Browse files Browse the repository at this point in the history
[YouTube] Fix getting the comment text if the comment contains a hashtag
  • Loading branch information
Stypox authored Jan 29, 2023
2 parents 999fb7f + 3f7df95 commit e920ab3
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,14 @@ public static String[] getYoutubeMusicKey()
@Nullable
public static String getUrlFromNavigationEndpoint(@Nonnull final JsonObject navigationEndpoint)
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")) {
String internUrl = navigationEndpoint.getObject("urlEndpoint").getString("url");
if (internUrl.startsWith("https://www.youtube.com/redirect?")) {
Expand Down

0 comments on commit e920ab3

Please sign in to comment.