Skip to content

Commit 8a4afe2

Browse files
committed
refactor split time parsing
1 parent 49b72cb commit 8a4afe2

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,16 @@ private YoutubeParsingHelper() {
3131
public static long parseDurationString(String input)
3232
throws ParsingException, NumberFormatException {
3333

34-
String[] splitInput;
35-
3634
// If time separator : is not detected, try . instead
37-
38-
if (input.contains(":")) {
39-
splitInput = input.split(":");
40-
} else {
41-
splitInput = input.split("\\.");
42-
}
43-
35+
36+
final String[] splitInput = input.contains(":")
37+
? input.split(":")
38+
: input.split("\\.");
39+
4440
String days = "0";
4541
String hours = "0";
4642
String minutes = "0";
47-
String seconds;
43+
final String seconds;
4844

4945
switch (splitInput.length) {
5046
case 4:

0 commit comments

Comments
 (0)