forked from platypush/platypush
[youtube
] Don't fail if some items in the response have missing attrs.
This commit is contained in:
parent
daa93f5994
commit
6411688e65
1 changed files with 4 additions and 4 deletions
|
@ -57,10 +57,10 @@ class YoutubePlugin(Plugin):
|
||||||
results = [
|
results = [
|
||||||
{
|
{
|
||||||
"url": "https://www.youtube.com" + item["url"],
|
"url": "https://www.youtube.com" + item["url"],
|
||||||
"title": item["title"],
|
"title": item.get("title", '[No title]'),
|
||||||
"image": item["thumbnail"],
|
"image": item.get("thumbnail"),
|
||||||
"duration": item["duration"],
|
"duration": item.get("duration", 0),
|
||||||
"description": item["shortDescription"],
|
"description": item.get("shortDescription"),
|
||||||
}
|
}
|
||||||
for item in rs.json().get("items", [])
|
for item in rs.json().get("items", [])
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue