Skip to content

Commit

Permalink
RUMBLE: fix extraction of video id for older java versions
Browse files Browse the repository at this point in the history
  • Loading branch information
evermind-zz committed Sep 20, 2024
1 parent 8eadaa1 commit c1f839e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ public static synchronized Map<String, List<String>> getMinimalHeaders() {
}

public static String getEmbedVideoId(final String rb) {
final String VALID_URL = "https?://(?:www\\.)?rumble\\.com/embed/(?:[0-9a-z]+\\.)?(?<id>[0-9a-z]+)";
final String EMBED_REGEX = "(?:<(?:script|iframe)[^>]+\\bsrc=|[\"']embedUrl[\"']\\s*:\\s*)[\"'](?<url>" + VALID_URL + ")";
final String VALID_URL = "https?://(?:www\\.)?rumble\\.com/embed/(?:[0-9a-z]+\\.)?([0-9a-z]+)"; // id is group 1
final String EMBED_REGEX = "(?:<(?:script|iframe)[^>]+\\bsrc=|[\"']embedUrl[\"']\\s*:\\s*)[\"']" + VALID_URL;
Pattern pattern = Pattern.compile(EMBED_REGEX);
Matcher matcher = pattern.matcher(rb);
if (matcher.find()) {
// Remove v (first character) from the id
return matcher.group(2).substring(1);
return matcher.group(1).substring(1);
} else {
return null;
}
Expand Down

0 comments on commit c1f839e

Please sign in to comment.