Skip to content

Commit

Permalink
Lines are updated for cleaner code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mertssmnoglu committed Apr 25, 2021
1 parent f4b11b7 commit 2527377
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,21 @@
USER_AGENT = data["user"]["USER_AGENT"]
systemLang = data["user"]["language"]
dirPath = data["user"]["file_dir"]
sep = data["system"][systemLang]["sep"]
lang = data["system"][systemLang]
sep = lang["sep"]
if systemLang in data["system"]:
today = now.day
this_month = data["system"][systemLang]["months"]["_" + str(now.month)]
this_month = lang["months"]["_" + str(now.month)]
this_year = now.year
startupText = data["system"][systemLang]["sentences"]["startupText"].format(
day=today, month=this_month, year=this_year
)
confirmText = data["system"][systemLang]["sentences"]["confirm"].lower()
dirError = data["system"][systemLang]["sentences"]['dirError']
end = data["system"][systemLang]["sentences"]['end']
startupText = lang["sentences"]["startupText"].format(day=today, month=this_month, year=this_year)
confirmText = lang["sentences"]["confirm"].lower()
dirError = lang["sentences"]['dirError']
end = lang["sentences"]['end']
url = f"https://{systemLang}.wikipedia.org/wiki/{today}_{this_month}"
inputText = data["system"][systemLang]["sentences"]["inputText"].format(
confirm=confirmText
)
inputText = lang["sentences"]["inputText"].format(confirm=confirmText)
print(f"<<< {startupText} >>>")
processText = data["system"][systemLang]["sentences"]["processText"].format(url=url)
fileWritingText = data["system"][systemLang]["sentences"]["writing"]
processText = lang["sentences"]["processText"].format(url=url)
fileWritingText = lang["sentences"]["writing"]
fileWriting = input(fileWritingText.format(confirm=confirmText))
answer = input(inputText)
if answer.lower() == confirmText:
Expand All @@ -35,11 +32,9 @@
if fileWriting.lower() == confirmText:
if not path.isdir(dirPath):
print(dirError)
quit()
else:
print(processText)
file = open(f"{dirPath}{today}_{this_month}.txt","w")
# file.write(f"{today} {this_month} ({systemLang})\n/* Is there a problem with the code? https://github.com/mertssmnoglu/wikipedia-scraper/issues */")
for job in all_Lists:
theindex = str(job.text).find(sep)
if(theindex != -1):
Expand All @@ -57,6 +52,5 @@
else:
print(end)
database.close()
quit()
else:
print(f"{systemLang} is not supported :/")

0 comments on commit 2527377

Please sign in to comment.