[videos] Fix youtube videos longer than an hour
This commit is contained in:
@ -40,10 +40,21 @@ def lookup_video_from_youtube(youtube_id: str) -> VideoMetadata:
|
|||||||
.get("contentDetails", {})
|
.get("contentDetails", {})
|
||||||
.get("duration")
|
.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:
|
||||||
if yt_metadata.get("channelId"):
|
if yt_metadata.get("channelId"):
|
||||||
|
|||||||
@ -53,7 +53,7 @@ class WebPage(ScrobblableMixin):
|
|||||||
if self.title:
|
if self.title:
|
||||||
return self.title
|
return self.title
|
||||||
if self.domain:
|
if self.domain:
|
||||||
return self.domain
|
return self.domain.name
|
||||||
return str(self.uuid)
|
return str(self.uuid)
|
||||||
|
|
||||||
def _raw_domain(self):
|
def _raw_domain(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user