Skip to content

Commit 8f71bde

Browse files
committed
Fix bug for YT videos longer than 1000h
1 parent aa277e1 commit 8f71bde

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.schabi.newpipe.extractor.services.youtube;
22

3-
43
import com.grack.nanojson.JsonArray;
54
import com.grack.nanojson.JsonObject;
65
import com.grack.nanojson.JsonParser;
@@ -111,9 +110,7 @@ public static boolean isInvidioURL(URL url) {
111110

112111
public static long parseDurationString(String input)
113112
throws ParsingException, NumberFormatException {
114-
115113
// If time separator : is not detected, try . instead
116-
117114
final String[] splitInput = input.contains(":")
118115
? input.split(":")
119116
: input.split("\\.");
@@ -145,10 +142,10 @@ public static long parseDurationString(String input)
145142
default:
146143
throw new ParsingException("Error duration string with unknown format: " + input);
147144
}
148-
return ((((Long.parseLong(days) * 24)
149-
+ Long.parseLong(hours) * 60)
150-
+ Long.parseLong(minutes)) * 60)
151-
+ Long.parseLong(seconds);
145+
return (((Long.parseLong(Utils.removeNonDigitCharacters(days)) * 24)
146+
+ Long.parseLong(Utils.removeNonDigitCharacters(hours)) * 60)
147+
+ Long.parseLong(Utils.removeNonDigitCharacters(minutes)) * 60)
148+
+ Long.parseLong(Utils.removeNonDigitCharacters(seconds));
152149
}
153150

154151
public static String getFeedUrlFrom(final String channelIdOrUser) {

0 commit comments

Comments
 (0)