Fix bug for YT videos longer than 1000h

This commit is contained in:
wb9688 2020-05-09 16:47:32 +02:00
parent aa277e1b6a
commit 8f71bde776
1 changed files with 4 additions and 7 deletions

View File

@ -1,6 +1,5 @@
package org.schabi.newpipe.extractor.services.youtube; package org.schabi.newpipe.extractor.services.youtube;
import com.grack.nanojson.JsonArray; import com.grack.nanojson.JsonArray;
import com.grack.nanojson.JsonObject; import com.grack.nanojson.JsonObject;
import com.grack.nanojson.JsonParser; import com.grack.nanojson.JsonParser;
@ -111,9 +110,7 @@ public class YoutubeParsingHelper {
public static long parseDurationString(String input) public static long parseDurationString(String input)
throws ParsingException, NumberFormatException { throws ParsingException, NumberFormatException {
// If time separator : is not detected, try . instead // If time separator : is not detected, try . instead
final String[] splitInput = input.contains(":") final String[] splitInput = input.contains(":")
? input.split(":") ? input.split(":")
: input.split("\\."); : input.split("\\.");
@ -145,10 +142,10 @@ public class YoutubeParsingHelper {
default: default:
throw new ParsingException("Error duration string with unknown format: " + input); throw new ParsingException("Error duration string with unknown format: " + input);
} }
return ((((Long.parseLong(days) * 24) return (((Long.parseLong(Utils.removeNonDigitCharacters(days)) * 24)
+ Long.parseLong(hours) * 60) + Long.parseLong(Utils.removeNonDigitCharacters(hours)) * 60)
+ Long.parseLong(minutes)) * 60) + Long.parseLong(Utils.removeNonDigitCharacters(minutes)) * 60)
+ Long.parseLong(seconds); + Long.parseLong(Utils.removeNonDigitCharacters(seconds));
} }
public static String getFeedUrlFrom(final String channelIdOrUser) { public static String getFeedUrlFrom(final String channelIdOrUser) {