40 except Exception
as e:
44 if "data" not in data
or "templates" not in data[
"data"]:
47 for entry
in data[
"data"][
"templates"]:
48 album_info = entry.get(
"albumInfo", {})
51 release_time = album_info.get(
"releaseTime", {}).get(
"value")
54 published_date = datetime.strptime(release_time,
"%Y-%m-%d")
55 except (ValueError, TypeError):
59 subscript_content = album_info.get(
"subscriptContent")
62 time_parts = subscript_content.split(
":")
63 if len(time_parts) == 2:
64 minutes, seconds = map(int, time_parts)
65 length = timedelta(minutes=minutes, seconds=seconds)
66 elif len(time_parts) == 3:
67 hours, minutes, seconds = map(int, time_parts)
68 length = timedelta(hours=hours, minutes=minutes, seconds=seconds)
69 except (ValueError, TypeError):
74 'url': album_info.get(
"pageUrl",
"").replace(
"http://",
"https://"),
75 'title': album_info.get(
"title",
""),
76 'content': album_info.get(
"brief", {}).get(
"value",
""),
77 'template':
'videos.html',
79 'publishedDate': published_date,
80 'thumbnail': album_info.get(
"img",
""),