mirror of
https://github.com/JonasunderscoreJones/turbo-octo-potato.git
synced 2025-10-25 19:19:19 +02:00
Added progress indicator
This commit is contained in:
parent
cec73a4e42
commit
d74248ffb5
1 changed files with 10 additions and 3 deletions
13
rpopfetch.py
13
rpopfetch.py
|
|
@ -204,7 +204,7 @@ def convert_monthly_content_to_json(content, year, month):
|
|||
print("[IGNORED] Error parsing line: '" + line + "'")
|
||||
print(e)
|
||||
|
||||
print(f"Found {len(json_data)} entries in {year}-{month}.")
|
||||
print(f" ==>Found {len(json_data)} entries in {year}-{month}.")
|
||||
return json_data
|
||||
|
||||
|
||||
|
|
@ -272,7 +272,14 @@ if content:
|
|||
|
||||
for wiki_link in content[::-1]:
|
||||
|
||||
print("Fetching monthly page: " + wiki_link)
|
||||
progress = int(content[::-1].index(wiki_link)/len(content)*100)
|
||||
|
||||
if progress < 10:
|
||||
progress = " " + str(progress)
|
||||
elif progress < 100:
|
||||
progress = " " + str(progress)
|
||||
|
||||
print(f"[{progress}%]Fetching monthly page: " + wiki_link)
|
||||
|
||||
try:
|
||||
# fetch the monthly page and parse it
|
||||
|
|
@ -285,7 +292,7 @@ if content:
|
|||
print(e)
|
||||
exit(1)
|
||||
|
||||
print("Parsed monthly page: " + wiki_link)
|
||||
print(f"[{progress}%]Parsed monthly page: " + wiki_link)
|
||||
|
||||
# sleep for 2 seconds to avoid getting rate limited
|
||||
# reddit api is awful
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue