Jefferson-Henrique / Jefferson-Henrique/GetOldTweets-python
Doesn't read dates without using today()
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 790
- PR merge metrics
- No merged PRs in 30d
Description
GOT seems to not be reading my date parameters correctly, and I'm not sure why. If I use date.today() it will read it correctly and get tweets, suggesting that the tool is working. However, if I specify a specific date manually it will not work.
To illustrate, the code below will not work as shown, with 'df' and 'dt' as parameters for tweet criteria. However, if I use variables 'today' and 'yesterday', which are defined using date.today() as a starting point, the code will collect tweets.
Many thanks in advance for your help.
---
import got
from datetime import date, timedelta
import datetime
import csv
today = date.today()
yesterday = today - timedelta(1)
print(today)
print(yesterday)
today.strftime('%m/%d/%Y')
today = str(today)
yesterday.strftime('%m/%d/%Y')
yesterday = str(yesterday)
#
dd = datetime.date(2018, 1, 1)
k = 5
dt = dd - timedelta(k)
df = dd - timedelta(k + 1)
df.strftime('%m/%d/%Y')
df = str(df)
print("FROM")
print(df)
dt.strftime('%m/%d/%Y')
dt = str(dt)
print("TO")
print(dt)
tweetCriteria = got.manager.TweetCriteria().setQuerySearch('@uber').setSince(df).setUntil(dt).setMaxTweets(20)
curtweets = got.manager.TweetManager.getTweets(tweetCriteria)
print(curtweets)
print("# TWEETS")
print(len(curtweets))
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.