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
4 changes: 2 additions & 2 deletions Exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def main(argv):

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

outputFile.write('username;date;retweets;favorites;text;geo;mentions;hashtags;id;permalink')
outputFile.write('username;date;retweets;favorites;comments;text;geo;mentions;hashtags;id;permalink')

print('Searching...\n')

def receiveBuffer(tweets):
for t in tweets:
outputFile.write(('\n%s;%s;%d;%d;"%s";%s;%s;%s;"%s";%s' % (t.username, t.date.strftime("%Y-%m-%d %H:%M"), t.retweets, t.favorites, t.text, t.geo, t.mentions, t.hashtags, t.id, t.permalink)))
outputFile.write(('\n%s;%s;%d;%d;%d;"%s";%s;%s;%s;"%s";%s' % (t.username, t.date.strftime("%Y-%m-%d %H:%M"), t.retweets, t.favorites, t.comments, t.text, t.geo, t.mentions, t.hashtags, t.id, t.permalink)))
outputFile.flush()
print('More %d saved on file...\n' % len(tweets))

Expand Down
3 changes: 2 additions & 1 deletion got/manager/TweetManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ def getTweets(tweetCriteria, receiveBuffer=None, bufferLength=100, proxy=None):
usernameTweet = tweetPQ("span:first.username.u-dir b").text()
txt = re.sub(r"\s+", " ", tweetPQ("p.js-tweet-text").text().replace('# ', '#').replace('@ ', '@'))
retweets = int(tweetPQ("span.ProfileTweet-action--retweet span.ProfileTweet-actionCount").attr("data-tweet-stat-count").replace(",", ""))
comments = int(tweetPQ("span.ProfileTweet-action--reply span.ProfileTweet-actionCount").attr("data-tweet-stat-count").replace(",", ""))
favorites = int(tweetPQ("span.ProfileTweet-action--favorite span.ProfileTweet-actionCount").attr("data-tweet-stat-count").replace(",", ""))
dateSec = int(tweetPQ("small.time span.js-short-timestamp").attr("data-time"))
id = tweetPQ.attr("data-tweet-id")
permalink = tweetPQ.attr("data-permalink-path")

geo = ''
geoSpan = tweetPQ('span.Tweet-geo')
if len(geoSpan) > 0:
Expand All @@ -57,6 +57,7 @@ def getTweets(tweetCriteria, receiveBuffer=None, bufferLength=100, proxy=None):
tweet.text = txt
tweet.date = datetime.datetime.fromtimestamp(dateSec)
tweet.retweets = retweets
tweet.comments = comments
tweet.favorites = favorites
tweet.mentions = " ".join(re.compile('(@\\w*)').findall(tweet.text))
tweet.hashtags = " ".join(re.compile('(#\\w*)').findall(tweet.text))
Expand Down