-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTreeUser.py
More file actions
40 lines (30 loc) · 1.02 KB
/
TreeUser.py
File metadata and controls
40 lines (30 loc) · 1.02 KB
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
import twint
import twint.output
import twint.tweet
import twint.user
class TreeUser:
def __init__(self, userin):
for attr in [x for x in dir(userin) if not x[0] == "_"]: # copy everything out of user object
try:
setattr(self, attr, getattr(userin, attr))
except:
pass
self.followersearched = False
self.followingsearched = False
self.tweetssearched = False
self.favouritessearched = False
self.followerslist = set()
self.followinglist = set()
self.tweets = []
self.favourites = []
self.tweetedhashtags = dict() # dict key is hashtag, value is number of times used
def __eq__(self, other): # Compare instances of TreeUser
if isinstance(other, TreeUser):
try:
if self.username == other.username:
return True
except AttributeError:
pass
return False
def __hash__(self):
return int(self.id)