Beispiel #1
0
    def get_feed_last_modified(self, feed, feed_response):
        """
        Returns the last modification date for the ``feed_response`` as a
        python datetime, or ``None`` if no date can be determined. By default,
        assumes that the response is a :mod:`feedparser` structure and returns
        a value based on that.

        """
        if 'updated_parsed' in feed_response.feed:
            return struct_time_to_datetime(feed_response.feed.updated_parsed)
        if 'published_parsed' in feed_response.feed:
            return struct_time_to_datetime(feed_response.feed.published_parsed)
        return None
Beispiel #2
0
    def parse_feed_entry(self, entry):
        soup = BeautifulSoup(entry['summary'])
        for tag in soup.find_all("img", limit=1):
            thumbnail_url = tag['src']
            print thumbnail_url
        for tag in soup.find_all("div", limit=1):
            description = ''.join(unicode(item) for item in tag.contents)
            print description

        id_start = entry['id'].rfind('/') + 1
        speakerdeck_id = entry['id'][id_start:]

        data = {
            'link': entry['link'],
            'title': entry['title'],
            'description': description,
            'thumbnail_url': thumbnail_url,
            'publish_datetime': struct_time_to_datetime(entry['published_parsed']),
            'user': entry['author'],
            'guid' : SpeakerDeckSuite.build_guid(speakerdeck_id),
        }
        return data