예제 #1
0
    def parsePost(self, post):
        if post["geo"]:
            pid = post["id"]
            user = post["user"]["screen_name"]
            name = post["user"]["name"]
            text = post["text"].encode('ascii', 'replace')
            latitude = post["geo"]["coordinates"][0]
            longitude = post["geo"]["coordinates"][1]
            profile_picture = post["user"]["profile_image_url_https"]
            created_time = time.strftime('%Y-%m-%d %H:%M:%S', time.strptime(post["created_at"],'%a %b %d %H:%M:%S +0000 %Y'))
            photo = ""

            tags = []
            for tag in post["entities"]["hashtags"]:
                tags.append(tag["text"])

            print('[+] Tweet ID: %s' % pid)
            print('\t[+] User: %s' % user)
            print('\t[+] Full Name: %s' % name)
            print('\t[+] Date of Creation: %s' % created_time)
            print('\t[+] Latitude: %s' % latitude)
            print('\t[+] Longitude: %s' % longitude)
            print('\t[+] Hashtags: %s' % tags)
            print('\t[+] Text: %s' % text)
            print('')

            utils = Utils()
            person = utils.get_user(user, name, profile_picture)
            p = utils.save_post(pid, person, created_time, photo, text, latitude, longitude, "Twitter")
            utils.save_tags(tags, p)

            return pid
예제 #2
0
    def parsePhoto(self, photo, latitude, longitude):
        title = photo['title']
        farm = photo['farm']
        server = photo['server']
        photo_id = photo['id']
        secret = photo['secret']
        owner = photo['owner']
        url = "https://farm%s.staticflickr.com/%s/%s_%s_n.jpg" % (farm, server, photo_id, secret)

        print('[+] Photo ID: %s' % photo_id)
        print('\t[*] URL: %s' % url)
        print('\t[*] Title: %s' % title)

        (user, name, profile_picture) = self.getPerson(owner)
        utils = Utils()
        person = utils.get_user(user, name, profile_picture)

        (created_time, tags) = self.getPhotoInfo(photo_id)
        p = utils.save_post(photo_id, person, created_time, url, title, latitude, longitude, "Flickr")
        utils.save_tags(tags, p)
        print('')
예제 #3
0
    def parsePhoto(self, photo, latitude, longitude):
        title = photo['title']
        farm = photo['farm']
        server = photo['server']
        photo_id = photo['id']
        secret = photo['secret']
        owner = photo['owner']
        url = "https://farm%s.staticflickr.com/%s/%s_%s_n.jpg" % (
            farm, server, photo_id, secret)

        print('[+] Photo ID: %s' % photo_id)
        print('\t[*] URL: %s' % url)
        print('\t[*] Title: %s' % title)

        (user, name, profile_picture) = self.getPerson(owner)
        utils = Utils()
        person = utils.get_user(user, name, profile_picture)

        (created_time, tags) = self.getPhotoInfo(photo_id)
        p = utils.save_post(photo_id, person, created_time, url, title,
                            latitude, longitude, "Flickr")
        utils.save_tags(tags, p)
        print('')
예제 #4
0
    def parsePost(self, post):
        if post["geo"]:
            pid = post["id"]
            user = post["user"]["screen_name"]
            name = post["user"]["name"]
            text = post["text"].encode('ascii', 'replace')
            latitude = post["geo"]["coordinates"][0]
            longitude = post["geo"]["coordinates"][1]
            profile_picture = post["user"]["profile_image_url_https"]
            created_time = time.strftime(
                '%Y-%m-%d %H:%M:%S',
                time.strptime(post["created_at"],
                              '%a %b %d %H:%M:%S +0000 %Y'))
            photo = ""

            tags = []
            for tag in post["entities"]["hashtags"]:
                tags.append(tag["text"])

            print('[+] Tweet ID: %s' % pid)
            print('\t[+] User: %s' % user)
            print('\t[+] Full Name: %s' % name)
            print('\t[+] Date of Creation: %s' % created_time)
            print('\t[+] Latitude: %s' % latitude)
            print('\t[+] Longitude: %s' % longitude)
            print('\t[+] Hashtags: %s' % tags)
            print('\t[+] Text: %s' % text)
            print('')

            utils = Utils()
            person = utils.get_user(user, name, profile_picture)
            p = utils.save_post(pid, person, created_time, photo, text,
                                latitude, longitude, "Twitter")
            utils.save_tags(tags, p)

            return pid