Skip to content

Commit dbf6ab9

Browse files
authored
Merge pull request #355 from Redirion/patch-1
Added a comment
2 parents 92f6754 + 5767549 commit dbf6ab9

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,12 @@ public static boolean isInvidioURL(URL url) {
108108
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");
109109
}
110110

111-
public static long parseDurationString(String input)
111+
/**
112+
* Parses the duration string of the video expecting ":" or "." as seperators
113+
* @return the duration in seconds
114+
* @throws ParsingException when more than 3 seperators are found
115+
*/
116+
public static int parseDurationString(final String input)
112117
throws ParsingException, NumberFormatException {
113118
// If time separator : is not detected, try . instead
114119
final String[] splitInput = input.contains(":")
@@ -143,10 +148,10 @@ public static long parseDurationString(String input)
143148
throw new ParsingException("Error duration string with unknown format: " + input);
144149
}
145150

146-
return ((Long.parseLong(Utils.removeNonDigitCharacters(days)) * 24
147-
+ Long.parseLong(Utils.removeNonDigitCharacters(hours))) * 60
148-
+ Long.parseLong(Utils.removeNonDigitCharacters(minutes))) * 60
149-
+ Long.parseLong(Utils.removeNonDigitCharacters(seconds));
151+
return ((Integer.parseInt(Utils.removeNonDigitCharacters(days)) * 24
152+
+ Integer.parseInt(Utils.removeNonDigitCharacters(hours))) * 60
153+
+ Integer.parseInt(Utils.removeNonDigitCharacters(minutes))) * 60
154+
+ Integer.parseInt(Utils.removeNonDigitCharacters(seconds));
150155
}
151156

152157
public static String getFeedUrlFrom(final String channelIdOrUser) {

0 commit comments

Comments
 (0)