Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main(argv):
return

try:
opts, args = getopt.getopt(argv, "", ("username=", "near=", "within=", "since=", "until=", "querysearch=", "toptweets", "maxtweets=", "output="))
opts, args = getopt.getopt(argv, "", ("username=", "near=", "within=", "since=", "until=", "querysearch=", "toptweets", "maxtweets=", "output=", "lang="))

tweetCriteria = got.manager.TweetCriteria()
outputFileName = "output_got.csv"
Expand Down Expand Up @@ -54,6 +54,9 @@ def main(argv):

elif opt == '--output':
outputFileName = arg

elif opt == '--lang':
tweetCriteria.lang = arg

outputFile = codecs.open(outputFileName, "w+", "utf-8")

Expand Down
1 change: 1 addition & 0 deletions exporter_help_text.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ To use this script you can pass the following attributes:
maxtweets: The maximum number of tweets to retrieve
toptweets: Only the tweets provided as top tweets by Twitter (no parameters required)
output: A filename to export the results (default is "output_got.csv")
lang: The language of the tweet

Examples:
# Example 1 - Get tweets by username [barackobama]
Expand Down
4 changes: 4 additions & 0 deletions got/manager/TweetCriteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ def setNear(self, near):
def setWithin(self, within):
self.within = within
return self

def setLang(self, lang):
self.lang = lang
return lang
3 changes: 3 additions & 0 deletions got/manager/TweetManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def getJsonReponse(tweetCriteria, refreshCursor, cookieJar, proxy):

if hasattr(tweetCriteria, 'until'):
urlGetData += ' until:' + tweetCriteria.until

if hasattr(tweetCriteria, 'lang'):
url += '&l=' + tweetCriteria.lang


if hasattr(tweetCriteria, 'topTweets'):
Expand Down