Commit ec6b95da authored by Cody Zacharias's avatar Cody Zacharias Committed by GitHub

Fix ending lag bug

parent 8496ba2c
...@@ -314,6 +314,7 @@ async def outTweet(tweet): ...@@ -314,6 +314,7 @@ async def outTweet(tweet):
datestamp = tweet.find("a", "tweet-timestamp")["title"].rpartition(" - ")[-1] datestamp = tweet.find("a", "tweet-timestamp")["title"].rpartition(" - ")[-1]
d = datetime.datetime.strptime(datestamp, "%d %b %Y") d = datetime.datetime.strptime(datestamp, "%d %b %Y")
date = d.strftime("%Y-%m-%d") date = d.strftime("%Y-%m-%d")
if arg.since and arg.until:
if (d.date() - datetime.datetime.strptime(arg.since, "%Y-%m-%d").date()).days == -1: if (d.date() - datetime.datetime.strptime(arg.since, "%Y-%m-%d").date()).days == -1:
if _since_def_user: if _since_def_user:
# mitigation here, maybe find something better # mitigation here, maybe find something better
...@@ -676,7 +677,7 @@ async def main(): ...@@ -676,7 +677,7 @@ async def main():
if arg.limit is not None and num >= int(arg.limit): if arg.limit is not None and num >= int(arg.limit):
break break
else: elif arg.since and arg.until:
while _since < _until: while _since < _until:
arg.since = str(_until - datetime.timedelta(days=int(arg.timedelta))) arg.since = str(_until - datetime.timedelta(days=int(arg.timedelta)))
arg.until = str(_until) arg.until = str(_until)
...@@ -695,6 +696,16 @@ async def main(): ...@@ -695,6 +696,16 @@ async def main():
# Control when we want to stop scraping. # Control when we want to stop scraping.
if arg.limit is not None and num >= int(arg.limit): if arg.limit is not None and num >= int(arg.limit):
break break
else:
while True:
if len(feed) > 0:
feed, init, count = await getTweets(init)
num += count
else:
break
if arg.limit is not None and num >= int(arg.limit):
break
if arg.database: if arg.database:
now = str(datetime.datetime.now()) now = str(datetime.datetime.now())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment