Merge pull request #134 from xPMo/pt-fix
Fall back to video['uuid'] if video['url'] doesn't exist
This commit is contained in:
commit
2f34059d57
|
@ -54,7 +54,7 @@ class MatrixModule(BotModule):
|
||||||
data = p.search(query, count)
|
data = p.search(query, count)
|
||||||
if len(data['data']) > 0:
|
if len(data['data']) > 0:
|
||||||
for video in data['data']:
|
for video in data['data']:
|
||||||
video_url = video["url"] #self.instance_url + 'videos/watch/' + video["uuid"]
|
video_url = video.get("url") or self.instance_url + 'videos/watch/' + video["uuid"]
|
||||||
duration = time.strftime('%H:%M:%S', time.gmtime(video["duration"]))
|
duration = time.strftime('%H:%M:%S', time.gmtime(video["duration"]))
|
||||||
instancedata = video["account"]["host"]
|
instancedata = video["account"]["host"]
|
||||||
html = f'<a href="{video_url}">{video["name"]}</a> {video["description"] or ""} [{duration}] @ {instancedata}'
|
html = f'<a href="{video_url}">{video["name"]}</a> {video["description"] or ""} [{duration}] @ {instancedata}'
|
||||||
|
|
Loading…
Reference in New Issue