diff --git a/clients/discord.py b/clients/discord.py index db08706..7000785 100644 --- a/clients/discord.py +++ b/clients/discord.py @@ -236,4 +236,11 @@ class DiscordClient(discord.Client): embed = discord.Embed(title=result['name'], url=result['url'], description=result['description'], color=0xffd700) embed.set_thumbnail(url=result['image']) + embed.set_image(url=result['image']) + for point in result['summary']: + try: + name, value = point.split(':') + except ValueError: + name, value = 'Base', point + embed.add_field(name=name.strip(), value=value.strip(), inline=True) await self.send_message(message.channel, embed=embed) diff --git a/services/cheesecom.py b/services/cheesecom.py index d837b03..dd2c33c 100644 --- a/services/cheesecom.py +++ b/services/cheesecom.py @@ -17,10 +17,14 @@ class CheeseCom(object): if not r.history: raise CheeseComError('no exact match') d = pq(r.content) + summary = [] + for p in d('ul[class="summary-points"]').find('p').items(): + summary.append(p.html(method='text')) return dict( url=d('meta[name="twitter:url"]').attr('content'), name=d('meta[name="twitter:title"]').attr('content'), description=d('meta[name="twitter:description"]').attr('content'), - image=d('meta[name="twitter:image"]').attr('content')) + image=d('meta[name="twitter:image"]').attr('content'), + summary=summary) except Exception as e: raise CheeseComError(str(e))