להורדה | השלמת שו"ת פרי עץ חיים
-
-
מהיכן המקור?
תביא קישור מדוייק.
לא ככה אנחנו עובדים.לכל דבר יש דרך וצורה איך מורידים, ואיך מטפלים.
-
@אהרן אני מבין שאתה לא רוצה לעזור לנו כ"כ, חבל.
לא מבין כ"כ מה המטרה שלך בפוסט הזה, אם אתה לא רוצה לעזור לנו....לעצם העניין, @האדם-החושב עיין כאן: https://files.dicta.org.il/books_internal.json
ולכאורה יוצא שאין שם בכלל את האפשרות להוריד את הגירסא של ה OCR מה שהיינו מורידים תמיד, אלא רק את: https://files.dicta.org.il/prietshaim/prietshaim__text_files.zip למרות שזה יורד בלי שום תגיות.
או שיש לך פתרון אחר לחידה הזו. -
@אהרן אני מבין שאתה לא רוצה לעזור לנו כ"כ, חבל.
לא מבין כ"כ מה המטרה שלך בפוסט הזה, אם אתה לא רוצה לעזור לנו....לעצם העניין, @האדם-החושב עיין כאן: https://files.dicta.org.il/books_internal.json
ולכאורה יוצא שאין שם בכלל את האפשרות להוריד את הגירסא של ה OCR מה שהיינו מורידים תמיד, אלא רק את: https://files.dicta.org.il/prietshaim/prietshaim__text_files.zip למרות שזה יורד בלי שום תגיות.
או שיש לך פתרון אחר לחידה הזו.@יום-חדש-מתחיל
פרי עץ חיים.rarimport io import json import re import zipfile from pathlib import Path import requests from tqdm import tqdm BASE_URL = "https://files.dicta.org.il/prietshaim/" def get_toc() -> list[dict]: url = BASE_URL + "pages.json" response = requests.get(url) return response.json() def get_page_content(page: str) -> dict: response = requests.get(BASE_URL + page) if page.endswith(".zip"): with zipfile.ZipFile(io.BytesIO(response.content)) as z, z.open(z.namelist()[0]) as f: return json.loads(f.read().decode("utf-8")) return response.json() def process_page(output_file: io.TextIOWrapper, content: list[dict]) -> None: for entry in content: if 'display' not in entry: output_file.write(entry['str']) continue for i in entry['display']: val = i["c"] heading = i.get("heading", False) bold = i.get("bold", False) if heading is True: output_file.write(f"<big>{val}</big>") elif bold is True: output_file.write(f"<b>{val}</b>") else: output_file.write(val) def main() -> None: book_name = "פרי עץ חיים" author = "" target_file_path = Path(f"{book_name}.txt") toc = get_toc() with target_file_path.open("w", encoding="utf-8") as output_file: output_file.write(f"<h1>{book_name}</h1>\n{author}") for entry in tqdm(toc, total=len(toc)): if entry["type"] == "index": continue page = entry["fileName"] display_name = entry["displayName"] output_file.write(f"\n<h2>{display_name}</h2>\n") content = get_page_content(page) process_page(output_file, content["tokens"]) with target_file_path.open("r", encoding="utf-8") as output_file: content = output_file.read() content = re.sub(r'\n+', '\n', content) with target_file_path.open("w", encoding="utf-8") as output_file: output_file.write(content) if __name__ == "__main__": main()
אגב, בזכות זה חקרתי קצת יותר את האתר של דיקטה ויתכן שיש דרך להוריד את הספרים שעדיין לא ערכו עם ירידות שורה, הדגשות וכו'.
-
@יום-חדש-מתחיל
פרי עץ חיים.rarimport io import json import re import zipfile from pathlib import Path import requests from tqdm import tqdm BASE_URL = "https://files.dicta.org.il/prietshaim/" def get_toc() -> list[dict]: url = BASE_URL + "pages.json" response = requests.get(url) return response.json() def get_page_content(page: str) -> dict: response = requests.get(BASE_URL + page) if page.endswith(".zip"): with zipfile.ZipFile(io.BytesIO(response.content)) as z, z.open(z.namelist()[0]) as f: return json.loads(f.read().decode("utf-8")) return response.json() def process_page(output_file: io.TextIOWrapper, content: list[dict]) -> None: for entry in content: if 'display' not in entry: output_file.write(entry['str']) continue for i in entry['display']: val = i["c"] heading = i.get("heading", False) bold = i.get("bold", False) if heading is True: output_file.write(f"<big>{val}</big>") elif bold is True: output_file.write(f"<b>{val}</b>") else: output_file.write(val) def main() -> None: book_name = "פרי עץ חיים" author = "" target_file_path = Path(f"{book_name}.txt") toc = get_toc() with target_file_path.open("w", encoding="utf-8") as output_file: output_file.write(f"<h1>{book_name}</h1>\n{author}") for entry in tqdm(toc, total=len(toc)): if entry["type"] == "index": continue page = entry["fileName"] display_name = entry["displayName"] output_file.write(f"\n<h2>{display_name}</h2>\n") content = get_page_content(page) process_page(output_file, content["tokens"]) with target_file_path.open("r", encoding="utf-8") as output_file: content = output_file.read() content = re.sub(r'\n+', '\n', content) with target_file_path.open("w", encoding="utf-8") as output_file: output_file.write(content) if __name__ == "__main__": main()
אגב, בזכות זה חקרתי קצת יותר את האתר של דיקטה ויתכן שיש דרך להוריד את הספרים שעדיין לא ערכו עם ירידות שורה, הדגשות וכו'.
@האדם-החושב מדהים!!