def get_random(self): url = "https://www.quotesdaddy.com/feed" bs = Util.xml_soup(url) item = bs.find("item") if not item: logger.warning(lambda: "Could not find quotes for URL " + url) return None link = item.find("link").contents[0].strip() s = item.find("description").contents[0] author = s[s.rindex('- ') + 1:].strip() quote = s[:s.rindex('- ')].strip().replace('"', '').replace('<br>', '\n').replace('<br/>', '\n').strip() quote = u"\u201C%s\u201D" % quote return [{"quote": quote, "author": author, "sourceName": "QuotesDaddy", "link": link}]
def get_random(self): url = "https://www.quotesdaddy.com/feed" bs = Util.xml_soup(url) item = bs.find("item") if not item: logger.warning(lambda: "Could not find quotes for URL " + url) return None link = item.find("link").contents[0].strip() s = item.find("description").contents[0] author = s[s.rindex('- ') + 1:].strip() quote = s[:s.rindex('- ')].strip().replace('"', '').replace('<br>', '\n').replace('<br/>', '\n').strip() quote = "\u201C%s\u201D" % quote return [{"quote": quote, "author": author, "sourceName": "QuotesDaddy", "link": link}]
def fetch(url, xml=False): return Util.xml_soup(url) if xml else Util.html_soup(url)
def get_quote(self): url = "http://www.zitate.eu/beruehmte-personen/zitate/rss/zz0/feed.xml" zitat = Util.xml_soup(url) zitat = zitat.find("title").contents[0].strip() return [{"quote": zitat, "author": "", "sourceName": "zitate.eu", "link": ""}]