Beispiel #1
0
    def gather_feed(self, feed):
        """ Given a feed, retrieves the items of the feed """
        content = utilityFunctions.feedparser_parse(feed.uri)
        items = list()
        if content:
            for entry in content["entries"]:
                d = defaultdict(str, entry)

                description = d["description"]
                if not description:
                    description = d["summary"]
                title = d["title"]
                link = d["link"]

                if not title and not description and not link:
                    print(
                        "WARNING: An entry from the feed with label "
                        + feed.name
                        + " has no title, description, or link. Skipped."
                        + str(entry)
                    )
                else:
                    item = Item(feed.name, title, Gatherer.description_cleanup(description), link)
                    items.append(item)

        feed.items = items
Beispiel #2
0
 def verify(self, warning_list):
     uri = self.retrieve()
     if not uri:
         return False  # A blank URI is always incorrect
     elif not (uri.startswith('/') or uri.startswith('http://') or uri.startswith('https://')):
             uri = 'http://' + uri  # Attempt to complete the URI #TODO: Instead of preemptively trying to fix it, probe it as is first.
     content = utilityFunctions.feedparser_parse(uri)  # Probe the URI
     if not content:
         warning_list.append('The URI ' + uri + ' did not contain a valid RSS feed.')
     return True