Merge pull request #134 from xPMo/pt-fix

Fall back to video['uuid'] if video['url'] doesn't exist
This commit is contained in:
Ville Ranki 2021-04-12 21:07:00 +03:00 committed by GitHub
commit 2f34059d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ class MatrixModule(BotModule):
data = p.search(query, count)
if len(data['data']) > 0:
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"]))
instancedata = video["account"]["host"]
html = f'<a href="{video_url}">{video["name"]}</a> {video["description"] or ""} [{duration}] @ {instancedata}'