49 for result
in json.get(
'result', []):
51 title = result.get(
"title")
52 thumbnailUrl = result.get(
"thumbnailUrl")
53 category = result.get(
"category/name")
54 username = result.get(
"user", {}).get(
"userName",
"")
55 url = f
'https://live.space/watch/{username}'
61 if result.get(
"tags"):
62 tags = [x
for x
in result.get(
"tags").split(
';')
if x
and x !=
'null']
63 tags =
', '.join(tags)
67 content.append(f
'category - {category}')
69 if tags
and len(tags) > 0:
70 content.append(f
'tags - {tags}')
74 if result.get(
"startTimeStamp"):
75 start_time = datetime.fromtimestamp(result.get(
"startTimeStamp") / 1000)
79 if result.get(
"endTimeStamp"):
80 end_time = datetime.fromtimestamp(result.get(
"endTimeStamp") / 1000)
84 delta = (now
if end_time
is None else end_time) - start_time
85 timestring = dates.format_timedelta(delta, granularity=
'second')
91 'content':
"No category or tags." if len(content) == 0
else ' '.join(content),
93 'length': (
">= " if end_time
is None else "") + timestring,
94 'publishedDate': start_time,
95 'thumbnail': thumbnailUrl,
96 'template':
'videos.html',