aboutsummaryrefslogtreecommitdiffstats
path: root/ytapi.py
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2019-01-08 20:35:12 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2019-01-08 20:35:12 +0000
commit5a8e9a81889b2c1520d68fbd1fd5e787a273113b (patch)
tree9af88b813a7b5bb42725c7d51cf47405a2cdba76 /ytapi.py
parent332ae56f3a241a89dddc920523c156d909aa1d36 (diff)
parent7937aadec4389bfe96d3d80cfad50312efa2e5d9 (diff)
downloadSmallYTChannelBot-5a8e9a81889b2c1520d68fbd1fd5e787a273113b.tar.gz
SmallYTChannelBot-5a8e9a81889b2c1520d68fbd1fd5e787a273113b.zip
updated database
Diffstat (limited to 'ytapi.py')
-rw-r--r--ytapi.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/ytapi.py b/ytapi.py
index b472b7e..267449b 100644
--- a/ytapi.py
+++ b/ytapi.py
@@ -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):