forked from Jefferson-Henrique/GetOldTweets-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.py
32 lines (23 loc) · 1.22 KB
/
Main.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
import got
def main():
def printTweet(descr, t):
print descr
print "Username: %s" % t.username
print "Retweets: %d" % t.retweets
print "Text: %s" % t.text
print "Mentions: %s" % t.mentions
print "Hashtags: %s\n" % t.hashtags
# Example 1 - Get tweets by username
tweetCriteria = got.manager.TweetCriteria().setUsername('barackobama').setMaxTweets(1)
tweet = got.manager.TweetManager.getTweets(tweetCriteria)[0]
printTweet("### Example 1 - Get tweets by username [barackobama]", tweet)
# Example 2 - Get tweets by query search
tweetCriteria = got.manager.TweetCriteria().setQuerySearch('europe refugees').setSince("2015-05-01").setUntil("2015-09-30").setMaxTweets(1)
tweet = got.manager.TweetManager.getTweets(tweetCriteria)[0]
printTweet("### Example 2 - Get tweets by query search [europe refugees]", tweet)
# Example 3 - Get tweets by username and bound dates
tweetCriteria = got.manager.TweetCriteria().setUsername("barackobama").setSince("2015-09-10").setUntil("2015-09-12").setMaxTweets(1)
tweet = got.manager.TweetManager.getTweets(tweetCriteria)[0]
printTweet("### Example 3 - Get tweets by username and bound dates [barackobama, '2015-09-10', '2015-09-12']", tweet)
if __name__ == '__main__':
main()