|
@@ -40,10 +40,21 @@ def lookup_video_from_youtube(youtube_id: str) -> VideoMetadata:
|
|
|
.get("contentDetails", {})
|
|
|
.get("duration")
|
|
|
)
|
|
|
- minutes = duration_iso8601.split("PT")[1].split("M")[0]
|
|
|
- seconds = duration_iso8601.split("PT")[1].split("M")[1].replace("S", "")
|
|
|
|
|
|
- duration = (int(minutes) * 60) + int(seconds)
|
|
|
+ duration_str = duration_iso8601.split("PT")[1]
|
|
|
+ hours = 0
|
|
|
+ minutes = 0
|
|
|
+ seconds = 0
|
|
|
+ if "H" in duration_str:
|
|
|
+ hours = duration_str.split("H")[0]
|
|
|
+ duration_str = duration_str.split("H")[1]
|
|
|
+ if "M" in duration_str:
|
|
|
+ minutes = duration_str.split("M")[0]
|
|
|
+ duration_str = duration_str.split("M")[1]
|
|
|
+ if "S" in duration_str:
|
|
|
+ seconds = duration_str.replace("S", "")
|
|
|
+
|
|
|
+ duration = (int(hours) * 60 * 60) + (int(minutes) * 60) + int(seconds)
|
|
|
|
|
|
if yt_metadata:
|
|
|
if yt_metadata.get("channelId"):
|