Beispiel #1
0
            return last_update

        return None

    def get_feed_etag(self, feed, response):
        return None

    def get_feed_webpage(self, feed, response):
        if 'User' in response:
            return u'http://www.slideshare.net/%s' % response['User']['Name']
        elif 'Tag' in response:
            return u'http://www.slideshare.net/tag/%s' % response['Tag']['Name']
        return ''

    def get_feed_entry_count(self, feed, feed_response):
        return feed_response['User']['Count']

    def get_feed_entries(self, feed, feed_response):
        if feed_response is None: # no more data
            return []
        elif 'User' in feed_response and 'Slideshow' in feed_response['User']:
            return reversed(feed_response['User']['Slideshow'])
        elif 'Tag' in feed_response and 'Slideshow' in feed_response['Tag']:
            return reversed(feed_response['Tag']['Slideshow'])
        return feed_response

    def parse_feed_entry(self, entry):
        return SlideShareApiMethod.parse_api_data(entry)

registry.register(SlideShareSuite)
Beispiel #2
0
            if feed_url.endswith('/'):
                return '%s.atom' % feed_url[:-1]
            return '%s.atom' % feed_url
        return feed_url

    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

registry.register(SpeakerDeckSuite)