Skip to content

Commit

Permalink
use substring instead of split
Browse files Browse the repository at this point in the history
  • Loading branch information
B0pol committed Feb 13, 2021
1 parent 81317cf commit 8db40db
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public String getId(String urlString) throws ParsingException, IllegalArgumentEx
switch (host.toUpperCase()) {
case "WWW.YOUTUBE-NOCOOKIE.COM": {
if (path.startsWith("embed/")) {
String id = path.split("/")[1];
String id = path.substring(6); // embed/

return assertIsId(id);
}
Expand Down Expand Up @@ -225,7 +225,7 @@ public boolean onAcceptUrl(final String url) throws FoundAdException {
private String getIdFromFoldersInPath(String path) throws ParsingException {
for (final String folder : folders) {
if (path.startsWith(folder)) {
String id = path.split("/")[1];
String id = path.substring(folder.length());
return assertIsId(id);
}
}
Expand Down

0 comments on commit 8db40db

Please sign in to comment.