diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2019-01-08 20:29:22 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2019-01-08 20:29:22 +0000 |
commit | 7937aadec4389bfe96d3d80cfad50312efa2e5d9 (patch) | |
tree | f13a2acf402872cf3937bceaf92505cf4fe2afcc /ytapi.py | |
parent | d6477e138753d8d1534faae3c23406ed6e4d6714 (diff) | |
download | SmallYTChannelBot-7937aadec4389bfe96d3d80cfad50312efa2e5d9.tar.gz SmallYTChannelBot-7937aadec4389bfe96d3d80cfad50312efa2e5d9.zip |
fixed a but with dates and fixed memory leak
Diffstat (limited to 'ytapi.py')
-rw-r--r-- | ytapi.py | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -33,17 +33,24 @@ get_videoId_from_url = js2py.eval_js(r"""function $(url){ }""") def _yt_time_to_norm(time): + origtime = time if time == "ERROR Video deleted?": return time - time = time.replace("M", ":")[2:].replace("S", "") + time = time[2:].replace("H", ":").replace("M", ":").replace("S", "") + + out = "" + for i in time.split(":"): + if len(i) == 1: + out += "0" + i + ":" + elif len(i) == 0: + out += "00:" + else: + out += i + ":" + + return out[:-1] - s = time.split(":") - if len(s) > 1: - if len(s[1]) < 2: - time = s[0] + ":" + s[1] + "0" - return time #this would be better as a class but I can't be bothered so dictionary it is def get_video_data(videoId): |