Added a comment

and fixed a "typo" in the method parseDurationString replacing Long with Integer.

These are not the droids you are looking for wb9688 😁
This commit is contained in:
Robin 2020-06-15 11:27:44 +02:00 committed by GitHub
parent 92f6754f0f
commit b63ae93495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 5 deletions

View File

@ -108,7 +108,12 @@ public class YoutubeParsingHelper {
return host.equalsIgnoreCase("invidio.us") || host.equalsIgnoreCase("dev.invidio.us") || host.equalsIgnoreCase("www.invidio.us") || host.equalsIgnoreCase("invidious.snopyta.org") || host.equalsIgnoreCase("de.invidious.snopyta.org") || host.equalsIgnoreCase("fi.invidious.snopyta.org") || host.equalsIgnoreCase("vid.wxzm.sx") || host.equalsIgnoreCase("invidious.kabi.tk") || host.equalsIgnoreCase("invidiou.sh") || host.equalsIgnoreCase("www.invidiou.sh") || host.equalsIgnoreCase("no.invidiou.sh") || host.equalsIgnoreCase("invidious.enkirton.net") || host.equalsIgnoreCase("tube.poal.co") || host.equalsIgnoreCase("invidious.13ad.de") || host.equalsIgnoreCase("yt.elukerio.org");
}
public static long parseDurationString(String input)
/**
* Parses the duration string of the video expecting ":" or "." as seperators
* @return the duration in seconds
* @throws ParsingException when more than 3 seperators are found
*/
public static int parseDurationString(String input)
throws ParsingException, NumberFormatException {
// If time separator : is not detected, try . instead
final String[] splitInput = input.contains(":")
@ -143,10 +148,10 @@ public class YoutubeParsingHelper {
throw new ParsingException("Error duration string with unknown format: " + input);
}
return ((Long.parseLong(Utils.removeNonDigitCharacters(days)) * 24
+ Long.parseLong(Utils.removeNonDigitCharacters(hours))) * 60
+ Long.parseLong(Utils.removeNonDigitCharacters(minutes))) * 60
+ Long.parseLong(Utils.removeNonDigitCharacters(seconds));
return ((Integer.parseInt(Utils.removeNonDigitCharacters(days)) * 24
+ Integer.parseInt(Utils.removeNonDigitCharacters(hours))) * 60
+ Integer.parseInt(Utils.removeNonDigitCharacters(minutes))) * 60
+ Integer.parseInt(Utils.removeNonDigitCharacters(seconds));
}
public static String getFeedUrlFrom(final String channelIdOrUser) {