コード例 #1
0
def parse_feeds(feed_urls, mod_since_utc=None, text_processor=None):
    """ Parses the specified feeds and returns their JSON representations

    RSS-Redirects are followed automatically by including both feeds in the
    result. """

    visited_urls = set()
    result = []

    for url in feed_urls:

        try:
            feed = parse_feed(url, text_processor, mod_since_utc)

        except FetchFeedException as ffe:
            feed = Feed()
            feed.urls = [url]
            feed.new_location = None
            feed.add_error('fetch-feed', str(ffe))

        if not feed:
            continue

        visited = feed.urls
        new_loc = feed.new_location

        # we follow RSS-redirects automatically
        if new_loc and new_loc not in (list(visited_urls) + visited):
            feed_urls.append(new_loc)

        visited_urls.add(url)

        result.append(feed)

    return result
コード例 #2
0
def parse_feeds(feed_urls, mod_since_utc=None, text_processor=None):
    """ Parses the specified feeds and returns their JSON representations

    RSS-Redirects are followed automatically by including both feeds in the
    result. """

    visited_urls = set()
    result = []

    for url in feed_urls:

        try:
            feed = parse_feed(url, text_processor, mod_since_utc)

        except FetchFeedException as ffe:
            feed = Feed()
            feed.urls = [url]
            feed.new_location = None
            feed.add_error('fetch-feed', str(ffe))

        if not feed:
            continue

        visited = feed.urls
        new_loc = feed.new_location

        # we follow RSS-redirects automatically
        if new_loc and new_loc not in (list(visited_urls) + visited):
            feed_urls.append(new_loc)

        visited_urls.add(url)

        result.append(feed)

    return result
コード例 #3
0
ファイル: feed.py プロジェクト: yradunchev/mygpo-feedservice
    def get_feed(self):
        feed = Feed(text_processor=self.text_processor)
        feed.title = self.get_title()
        feed.link = self.get_link()
        feed.description = self.get_description()
        feed.subtitle = self.get_subtitle()
        feed.author = self.get_author()
        feed.language = self.get_language()
        feed.urls = self.get_urls()
        feed.new_location = self.get_new_location()
        feed.logo = self.get_logo_url()
        feed.tags = self.get_feed_tags()
        feed.hub = self.get_hub_url()
        feed.http_last_modified = self.get_last_modified()
        feed.http_etag = self.get_etag()
        feed.flattr = self.get_flattr()
        feed.license = self.get_license()

        #feed.logo_data = self.get_logo_inline()

        feed.set_episodes(self.get_episodes())

        return feed
コード例 #4
0
ファイル: feed.py プロジェクト: gpodder/mygpo-feedservice
    def get_feed(self):
        feed = Feed(text_processor=self.text_processor)
        feed.title = self.get_title()
        feed.link = self.get_link()
        feed.description = self.get_description()
        feed.subtitle = self.get_subtitle()
        feed.author = self.get_author()
        feed.language = self.get_language()
        feed.urls = self.get_urls()
        feed.new_location = self.get_new_location()
        feed.logo = self.get_logo_url()
        feed.tags = self.get_feed_tags()
        feed.hub = self.get_hub_url()
        feed.http_last_modified = self.get_last_modified()
        feed.http_etag = self.get_etag()
        feed.flattr = self.get_flattr()
        feed.license = self.get_license()

        #feed.logo_data = self.get_logo_inline()

        feed.set_episodes(self.get_episodes())

        return feed