diff --git a/__pycache__/galdPl.cpython-312.pyc b/__pycache__/galdPl.cpython-312.pyc new file mode 100644 index 0000000..7084afe Binary files /dev/null and b/__pycache__/galdPl.cpython-312.pyc differ diff --git a/main.py b/main.py index a015ee8..c8a8d43 100644 --- a/main.py +++ b/main.py @@ -17,11 +17,13 @@ def get_json_files_from_folder(folder): r.raise_for_status() soup = BeautifulSoup(r.text, "html.parser") files = [] - for a in soup.find_all("a", class_="ui basic label"): + # Hledáme odkazy s .json v href + for a in soup.find_all("a", href=lambda x: x and x.endswith('.json')): href = a.get("href", "") - if href.endswith(".json"): - file_path = href.split("/resources/")[-1] - files.append(file_path) + if href.startswith("/gald/galdistream/src/branch/main/resources/"): + # Extrahujeme pouze název souboru + file_name = href.split("/")[-1] + files.append(file_name) return files def update_json_db(): @@ -30,7 +32,8 @@ def update_json_db(): all_files = [] for folder in folders: try: - all_files += [f"{folder}/{file}" for file in get_json_files_from_folder(folder)] + files = get_json_files_from_folder(folder) + all_files += [f"{folder}/{file}" for file in files] except Exception as e: print(f"Chyba při získávání souborů ze složky {folder}: {e}") for file in all_files: