Add duration in seconds to Get Videos
The Get Videos API presents the duration as a string, example: "3h8m33s"
Please add an additional key of "duration_seconds" of the time of the video in seconds.
With the older v5 API I can just do the following in Python:
duration = timedelta(seconds=int(data["length"]))
With the Helix API endpoint, I had to set up the following function instead (ignore the dashes since spacing at the start was removed):
hms_pattern = re.compile(r"(?:(?P<hours>\d+)h)?(?:(?P<minutes>\d+)m)?(?P<seconds>\d+)s", re.I)
def parse_hms(hms_string: str) -> timedelta:
----tdict = dict()
----tmatch = re.search(hms_pattern, hms_string)
----if tmatch is None:
----for k, v in tmatch.groupdict().items():
--------tdict[k] = 0 if v is None else int(v)
Save having to do the math myself/parsing the format twitch uses
If a field with the total number of seconds was included, how would this be helpful in your development?