-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitter_object.py
41 lines (37 loc) · 1.15 KB
/
twitter_object.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from ugly import tweetUnescape
class Tweet(object):
def __init__(self, data):
self.data = data
self.id = data["id_str"]
self.text = tweetUnescape( data["text"] )
self.owner = data["user"]["screen_name"]
class DirectMessage(object):
def __init__(self, data):
self.data = data
self.id = data["id_str"]
self.sender = data["sender_screen_name"]
self.text = tweetUnescape( data["text"] )
class ListInfo(object):
def __init__(self, data):
self.data = data
self.id = data["id_str"]
self.full_name = data["full_name"]
self.descrpition = data["description"]
self.member = data["member_count"]
self.subscriber = data["subscriber_count"]
class Status(object):
def __init__(self, data):
self.data = data
self.name = data["name"]
self.location = data["location"]
self.description = data["description"]
self.screen_name = data["screen_name"]
self.id = data["id"]
self.statuses_count = data["statuses_count"]
self.friends_count = data["friends_count"]
self.followers_count = data["followers_count"]
try:
data["status"]["user"] = { "screen_name" : self.screen_name }
self.status = Tweet(data["status"])
except:
self.status = None