Skip to content

Commit

Permalink
style: format code with Black
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in daeb263 according to the output
from Black.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Dec 23, 2023
1 parent daeb263 commit c9c085c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 3 additions & 5 deletions cookie_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,17 @@
else:
break


def maximum():
count = 0
for files in os.walk(folder_path):
count += len(files)
return count


rand_number = random.randint(1, 99999)

progress = 0
pbar = progressbar.ProgressBar(maxval=maximum())


def convert_netscape_cookie_to_json(cookie_file_content):
cookies = []
for line in cookie_file_content.splitlines():
Expand All @@ -58,7 +55,6 @@ def convert_netscape_cookie_to_json(cookie_file_content):
json_content = json.dumps(cookies, indent=4)
return json_content


path = "json_cookies"
try:
os.mkdir(path)
Expand Down Expand Up @@ -124,7 +120,9 @@ def convert_netscape_cookie_to_json(cookie_file_content):

json_data = convert_netscape_cookie_to_json(content)

with open(f"temp {rand_number}/{filename}", "w", encoding="utf-8") as f:
with open(
f"temp {rand_number}/{filename}", "w", encoding="utf-8"
) as f:
f.write(json_data)
print(f"{filename} - DONE!")
if 0 <= progress <= maximum():
Expand Down
8 changes: 1 addition & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
)
sys.exit()


else:
import tkinter
from tkinter import filedialog
Expand All @@ -36,24 +35,20 @@
else:
print(f"Using path: {folder_path}")


def maximum():
count = 0
for root_dir, cur_dir, files in os.walk(r"json_cookies"):
count += len(files)
return count


progress = 0
pbar = progressbar.ProgressBar(maxval=maximum())


def load_cookies_from_json(json_cookies_path):
with open(json_cookies_path, "r", encoding="utf-8") as cookie_file:
cookie = json.load(cookie_file)
return cookie


def open_webpage_with_cookies(link, json_cookies):
global progress
global working_cookies
Expand All @@ -72,7 +67,7 @@ def open_webpage_with_cookies(link, json_cookies):
progress += 1

if driver.find_elements(By.CSS_SELECTOR, ".btn") or driver.find_elements(
By.CSS_SELECTOR, ".e1ax5wel1"
By.CSS_SELECTOR, ".e1ax5wel1"
):
print(f"Cookie Not working - {filename}")
driver.quit()
Expand All @@ -92,7 +87,6 @@ def open_webpage_with_cookies(link, json_cookies):
driver.quit()
working_cookies += 1


for filename in os.listdir("json_cookies"):
filepath = os.path.join("json_cookies", filename)
if os.path.isfile(filepath):
Expand Down

0 comments on commit c9c085c

Please sign in to comment.