diff --git a/vrobbler/apps/videos/sources/youtube.py b/vrobbler/apps/videos/sources/youtube.py index cf48078..d538b28 100644 --- a/vrobbler/apps/videos/sources/youtube.py +++ b/vrobbler/apps/videos/sources/youtube.py @@ -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"): diff --git a/vrobbler/apps/webpages/models.py b/vrobbler/apps/webpages/models.py index 85ead43..a92414c 100644 --- a/vrobbler/apps/webpages/models.py +++ b/vrobbler/apps/webpages/models.py @@ -53,7 +53,7 @@ class WebPage(ScrobblableMixin): if self.title: return self.title if self.domain: - return self.domain + return self.domain.name return str(self.uuid) def _raw_domain(self):