Exemple #1
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.link = urllib.parse.urljoin('http://www.reddit.com',
                                      raw['data']['permalink'])
        e.title = raw['data']['title']
        e.occurred = datetime.datetime.utcnow()
        e.thumbnail_url = raw['data']['url']
        e.archive_url = raw['data']['url']
        e.raw = raw

        return e
Exemple #2
0
    def to_event(self, raw):
        e = Event()
        e.feed = self.dict()
        e.title = raw['d']
        e.link = raw['u']
        e.occurred = datetime.datetime.strptime(
            raw['dt'], '%Y-%m-%dT%H:%M:%SZ'
        )
        e.thumbnail_url = raw['u']
        e.archive_url = raw['u']
        e.raw = raw

        return e