Commit 600c836e authored by Francesco Poldi's avatar Francesco Poldi

Merge remote-tracking branch 'origin/master'

parents d76e5bc4 ec6b95da
...@@ -314,10 +314,11 @@ async def outTweet(tweet): ...@@ -314,10 +314,11 @@ 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 (d.date() - datetime.datetime.strptime(arg.since, "%Y-%m-%d").date()).days == -1: if arg.since and arg.until:
if _since_def_user: if (d.date() - datetime.datetime.strptime(arg.since, "%Y-%m-%d").date()).days == -1:
# mitigation here, maybe find something better if _since_def_user:
sys.exit(0) # mitigation here, maybe find something better
sys.exit(0)
timestamp = str(datetime.timedelta(seconds=int(tweet.find("span", "_timestamp")["data-time"]))).rpartition(", ")[-1] timestamp = str(datetime.timedelta(seconds=int(tweet.find("span", "_timestamp")["data-time"]))).rpartition(", ")[-1]
t = datetime.datetime.strptime(timestamp, "%H:%M:%S") t = datetime.datetime.strptime(timestamp, "%H:%M:%S")
time = t.strftime("%H:%M:%S") time = t.strftime("%H:%M:%S")
...@@ -694,7 +695,7 @@ async def main(): ...@@ -694,7 +695,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)
...@@ -713,6 +714,16 @@ async def main(): ...@@ -713,6 +714,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