31 lines
867 B
Python
31 lines
867 B
Python
#!/usr/bin/env python3
|
|
|
|
from plugins.plugin import Plugin
|
|
|
|
from bs4 import BeautifulSoup
|
|
import requests
|
|
|
|
|
|
class FreeGames(Plugin):
|
|
def activate(self):
|
|
super(FreeGames, self).activate()
|
|
|
|
def deactivate(self):
|
|
super(FreeGames, self).deactivate()
|
|
|
|
@Plugin.command()
|
|
def epic(self, room, event, args):
|
|
"""Display Epic free games => !epic"""
|
|
r=requests.get('https://feed.phenx.de/lootscraper_epic_game.xml')
|
|
soup = BeautifulSoup(r.content, 'xml')
|
|
c_list = soup.find_all('entry')
|
|
for c in c_list:
|
|
link = c.find('link').get('href')
|
|
title = c.find('title')
|
|
content = "{}\n".format(title.text)
|
|
content = "{}\n\n".format(link)
|
|
for li in c.find_all('li'):
|
|
content += "- {}\n".format(li.text)
|
|
room.send_text(content)
|
|
|