adding the twitter username utilisation if asked, and the possibility of scrap tweets with no limits (even tho the limitation will be the numbers of tweets that the browser is able to handle)

This commit is contained in:
MagiPrince
2024-03-22 15:05:04 +01:00
parent ac2f8cc600
commit 0a1c607e55
4 changed files with 117 additions and 22 deletions

View File

@@ -7,7 +7,7 @@ class Progress:
self.total = total
pass
def print_progress(self, current) -> None:
def print_progress(self, current, waiting, retry_cnt, no_tweets_limit) -> None:
self.current = current
progress = current / self.total
bar_length = 40
@@ -17,9 +17,30 @@ class Progress:
+ "-" * (bar_length - int(bar_length * progress))
+ "]"
)
sys.stdout.write(
"\rProgress: [{:<40}] {:.2%} {} of {}".format(
progress_bar, progress, current, self.total
)
)
if no_tweets_limit:
if waiting:
sys.stdout.write(
"\rTweets scrapped : {} - waiting to access older tweets {} min on 15 min".format(
current, retry_cnt
)
)
else:
sys.stdout.write(
"\rTweets scrapped : {} ".format(
current
)
)
else:
if waiting:
sys.stdout.write(
"\rProgress: [{:<40}] {:.2%} {} of {} - waiting to access older tweets {} min on 15 min".format(
progress_bar, progress, current, self.total, retry_cnt
)
)
else:
sys.stdout.write(
"\rProgress: [{:<40}] {:.2%} {} of {} ".format(
progress_bar, progress, current, self.total
)
)
sys.stdout.flush()