Closed abhishekmj303 closed 1 month ago
So I'm not sure what the correct behavior is here...
Afaik from sources on the internet, YT's max video duration is 12h.
Since the video you linked is not playable either I would assume that it's simply an invalid entry. Not sure we'd even want to parse the duration in that case.
Granted we should not crash but return None
as duration
instead.
The fix you provided here is also locale dependent and would break for German localization
duration: 13.165:23:44
The fix you provided here is also locale dependent and would break for German localization
duration: 13.165:23:44
Good point, I did not think of this. If the locale is known then we can use the function locale.atoi
. Reference
But if this is not possible then this the way:
Granted we should not crash but return None as duration instead.
Are there any videos with 1k+ hours that are actually playable? If yes I'd have a go with atoi. If no, don't bother and just return None
fyi there is already a to_int
function that uses atoi
Are there any videos with 1k+ hours that are actually playable?
I think they are not playable. The current longest playable video on youtube I was able to find is about 300hrs (https://youtu.be/kj4LxVhx2-A). So just returning None should be fine.
@abhishekmj303 ok yes, let's do that.
I guess you could check if the result of duration.split(":")
contains any non-digit characters and then fall back to None
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.09%. Comparing base (
2b5d19a
) to head (faf1dc5
). Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@sigma67 Not sure what tests and where I need to add them. Can you help me here?
@abhishekmj303 Thanks! Everything looks good now
Fixes #660