From e2d3d304d11138f01dfa9eeded982b718b884ca1 Mon Sep 17 00:00:00 2001 From: David Rotermund <54365609+davrot@users.noreply.github.com> Date: Thu, 18 May 2023 15:13:04 +0200 Subject: [PATCH] Add files via upload --- content/is_english_content.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/content/is_english_content.py b/content/is_english_content.py index a7efe3b..144fc93 100644 --- a/content/is_english_content.py +++ b/content/is_english_content.py @@ -12,21 +12,18 @@ def is_english_content( with open(string_json_path, "r") as file: string_dict = json.load(file) + print(f"Is english? Check {content_id}") + found_element_list = driver.find_elements(By.TAG_NAME, "div") for element in found_element_list: - dtab = str(element.get_dom_attribute("data-table")) - duid = str(element.get_dom_attribute("data-uid")) - dtyp = str(element.get_dom_attribute("data-ctype")) - if ( - (dtab == "tt_content") - and (duid == str(content_id)) - and (dtyp == "textmedia") - ): - sub_element_list = element.find_elements(By.TAG_NAME, "img") - for sub_element in sub_element_list: - img_name = str(sub_element.get_dom_attribute("src")) - if img_name.endswith(string_dict["search_for_string"]): - return True + if str(element.get_dom_attribute("data-table")) == "tt_content": + if str(element.get_dom_attribute("data-ctype")) == "textmedia": + if str(element.get_dom_attribute("data-uid")) == str(content_id): + sub_element_list = element.find_elements(By.TAG_NAME, "img") + for sub_element in sub_element_list: + img_name = str(sub_element.get_dom_attribute("src")) + if img_name.endswith(string_dict["search_for_string"]): + return True return False