{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "3ad8a4e5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "LINKS: 16\n", "LINKS: 205\n", "LINKS: 205\n", "LINKS: 206\n", "LINKS: 209\n", "LINKS: 209\n", "LINKS: 209\n", "LINKS: 311\n", "LINKS: 414\n", "LINKS: 422\n", "LINKS: 439\n", "LINKS: 547\n", "LINKS: 38282\n", "LINKS: 38282\n", "LINKS: 38362\n", "LINKS: 38444\n", "LINKS: 38865\n", "LINKS: 39225\n", "LINKS: 39409\n", "LINKS: 39428\n", "LINKS: 42389\n", "LINKS: 42389\n", "LINKS: 42883\n", "LINKS: 44050\n", "LINKS: 45237\n", "LINKS: 45244\n", "LINKS: 45273\n", "LINKS: 48223\n", "LINKS: 48223\n", "LINKS: 48393\n", "LINKS: 48397\n", "LINKS: 48426\n", "LINKS: 49124\n", "LINKS: 52685\n", "LINKS: 52685\n", "LINKS: 52742\n", "LINKS: 52849\n", "LINKS: 53019\n", "LINKS: 53392\n", "LINKS: 53502\n", "LINKS: 57352\n", "LINKS: 68939\n", "LINKS: 68939\n", "LINKS: 69466\n", "LINKS: 69937\n", "LINKS: 69940\n", "LINKS: 69940\n", "LINKS: 70100\n", "LINKS: 70112\n", "LINKS: 70142\n", "LINKS: 70394\n", "LINKS: 70995\n", "LINKS: 71344\n", "LINKS: 71866\n", "LINKS: 72785\n", "LINKS: 72844\n", "LINKS: 73216\n", "LINKS: 73216\n", "LINKS: 75343\n", "LINKS: 75815\n", "LINKS: 77157\n", "LINKS: 78564\n", "LINKS: 78621\n", "LINKS: 78639\n", "LINKS: 78905\n", "LINKS: 79193\n", "LINKS: 79512\n", "LINKS: 82045\n", "LINKS: 82045\n", "LINKS: 82492\n", "LINKS: 82552\n", "LINKS: 82558\n", "LINKS: 82614\n", "LINKS: 82633\n", "LINKS: 82890\n", "LINKS: 82958\n", "LINKS: 83247\n", "LINKS: 83587\n", "LINKS: 83673\n", "LINKS: 85975\n", "LINKS: 85975\n", "LINKS: 89608\n", "LINKS: 92058\n", "LINKS: 94466\n", "LINKS: 96688\n", "LINKS: 96897\n", "LINKS: 100521\n", "LINKS: 103225\n", "LINKS: 118807\n", "LINKS: 119772\n", "LINKS: 122334\n", "LINKS: 122519\n", "LINKS: 126290\n", "LINKS: 126290\n", "LINKS: 128504\n", "LINKS: 129975\n", "LINKS: 130195\n", "LINKS: 131005\n", "LINKS: 132347\n", "LINKS: 132670\n", "LINKS: 134317\n", "LINKS: 134320\n", "LINKS: 134320\n", "LINKS: 134329\n", "LINKS: 134329\n", "LINKS: 134342\n", "LINKS: 134452\n", "LINKS: 134452\n", "LINKS: 134452\n", "LINKS: 134456\n", "LINKS: 134459\n", "LINKS: 134459\n", "LINKS: 134459\n", "LINKS: 134459\n", "LINKS: 134652\n", "LINKS: 134652\n", "LINKS: 134654\n", "LINKS: 134677\n", "LINKS: 134681\n", "LINKS: 134681\n", "LINKS: 134682\n", "LINKS: 134788\n", "LINKS: 134788\n", "LINKS: 134791\n", "LINKS: 134791\n", "LINKS: 134792\n", "LINKS: 134833\n", "LINKS: 135006\n", "LINKS: 135006\n", "LINKS: 135006\n", "LINKS: 135008\n", "LINKS: 135020\n", "LINKS: 135022\n", "LINKS: 135022\n", "LINKS: 135057\n", "LINKS: 136403\n", "LINKS: 136403\n", "LINKS: 136409\n", "LINKS: 136481\n", "LINKS: 136481\n", "LINKS: 136481\n", "LINKS: 136481\n", "LINKS: 136481\n", "LINKS: 136481\n", "LINKS: 136481\n", "LINKS: 136483\n", "LINKS: 136492\n", "LINKS: 136503\n", "LINKS: 136534\n", "LINKS: 136539\n", "LINKS: 136543\n", "LINKS: 136543\n", "LINKS: 136561\n", "LINKS: 136569\n", "LINKS: 136601\n", "LINKS: 136633\n", "LINKS: 136633\n", "LINKS: 136633\n", "LINKS: 136641\n", "LINKS: 136641\n", "LINKS: 136642\n", "LINKS: 136717\n", "LINKS: 136717\n", "LINKS: 136717\n", "LINKS: 136717\n", "LINKS: 136717\n", "LINKS: 136717\n", "LINKS: 136718\n", "LINKS: 136718\n", "LINKS: 136718\n", "LINKS: 136718\n", "LINKS: 136725\n", "LINKS: 136727\n", "LINKS: 136727\n", "LINKS: 136727\n", "LINKS: 136782\n", "LINKS: 136792\n", "LINKS: 136904\n", "LINKS: 136931\n", "LINKS: 136932\n", "LINKS: 136961\n", "LINKS: 137137\n", "LINKS: 137333\n", "LINKS: 137741\n", "LINKS: 137970\n", "LINKS: 137970\n", "LINKS: 138275\n", "LINKS: 138275\n", "LINKS: 138314\n", "LINKS: 138334\n", "LINKS: 138334\n", "LINKS: 138335\n", "LINKS: 138361\n", "LINKS: 138374\n", "LINKS: 138609\n", "LINKS: 138609\n", "LINKS: 138609\n" ] } ], "source": [ "# code by Sett Sarverott A.A.B. @ 2026\n", "# Inceptorium Apokryf for SJP \n", "# on terms of license GNU GPL 2.0\n", "\n", "\n", "import requests\n", "import bs4\n", "import markdownify\n", "import zipfile\n", "import urllib\n", "import json\n", "import zlib\n", "\n", "sjpUrl = \"https://sjp.pl/sl/zm.phtml\"\n", "\n", "sjpEditsList = requests.get(sjpUrl).text\n", "\n", "with open(\"./sjp-changelogs.md\", \"w\") as sjpChgLog:\n", " sjpChgLog.write(markdownify.markdownify(sjpEditsList))\n", "\n", "webpage = bs4.BeautifulSoup(sjpEditsList)\n", "\n", "with open(\"./links.json\", \"r\") as sjpPage:\n", " links = set(json.loads(sjpPage.read()))\n", "\n", "changelist = list()\n", "\n", "# links = set()\n", "\n", "#webpage = bs4.BeautifulSoup(sourceserver.text)\n", "\n", "print(\"LINKS:\", len(links))\n", "\n", "for link in webpage.find_all(\"a\"):\n", " #print(link)\n", " try:\n", " links.add(\n", " urllib.parse.urljoin(sjpUrl, str(link.get(\"href\")))\n", " )\n", " changelist.append(\n", " [\n", " link.string,\n", " urllib.parse.urljoin(sjpUrl, str(link.get(\"href\")))\n", " ]\n", " )\n", " except Exception as error:\n", " print(\"ERROR:\", error)\n", "\n", "print(\"LINKS:\", len(links))\n", "\n", "with open(\"./links.json\", \"w\") as sjpPage:\n", " sjpPage.write(json.dumps(list(links)))\n", "\n", "for periodlist in changelist:\n", " print(\"LINKS:\", len(links))\n", " try:\n", "\n", " sjpEditsList = requests.get(periodlist[1]).text\n", "\n", " # with open(\"./sjp-changelogs.md\", \"w\") as sjpChgLog:\n", " # sjpChgLog.write(markdownify.markdownify(sjpEditsList))\n", "\n", " webpage = bs4.BeautifulSoup(sjpEditsList)\n", "\n", " for link in webpage.find_all(\"a\"):\n", " #print(link)\n", " links.add(\n", " urllib.parse.urljoin(periodlist[1], str(link.get(\"href\")))\n", " )\n", " \n", " with open(\"./links.json\", \"w\") as sjpPage:\n", " sjpPage.write(json.dumps(list(links)))\n", "\n", " except Exception as error:\n", " print(\"ERROR:\", error)\n", "\n", "\n", "links.add(\"https://the-apokryf.github.io\")\n", "\n", "\n", "with open(\"./links.json\", \"w\") as sjpPage:\n", " sjpPage.write(json.dumps(list(links)))\n" ] }, { "cell_type": "code", "execution_count": null, "id": "7b29b139", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "SplitResult(scheme='https', netloc='sjp.pl', path='/prze%C5%82amywajmy%C5%BC', query='', fragment='')\n", "przełamywajmyż\n", "['przełamywajmyż']\n", "['40c207f9-aecccea1']\n", "przełamywajmyż\n", "[['p', 14, 'ż'], ['40c207f9-aecccea1']]\n" ] } ], "source": [ "# from huggingface_hub import login, upload_folder\n", "\n", "# def sendDataset():\n", "# login()\n", "\n", "# upload_folder(\n", "# folder_path=\".\", \n", "# repo_id=\"Apokryf/SJP\", \n", "# repo_type=\"dataset\"\n", "# )\n", "\n", "# sendDataset()\n", "\n", "import json\n", "import urllib\n", "import os\n", "import zlib\n", "import yaml\n", "\n", "linklist = set()\n", "\n", "with open(\"./links.json\", \"r\") as links:\n", " linklist=set(json.loads(links.read()))\n", "\n", "def paratangle(data):\n", " return [\n", " hex(zlib.adler32(data.encode(\"utf-8\")))[2:],\n", " hex(zlib.crc32(data.encode(\"utf-8\")))[2:]\n", " ]\n", "\n", "def get_authenticity(stringtoshorten):\n", " stringtoshorten = stringtoshorten.strip()\n", " \n", " strtokens = stringtoshorten.replace(\"-\", \" \").replace(\"_\", \" \").replace(\"'\", \" \").split(\" \")\n", " chainA12Y = list()\n", " pretanglants = [\"-\".join(paratangle(stringtoshorten))]\n", " print(strtokens)\n", " print(pretanglants)\n", " for talkEn in strtokens:\n", " print(talkEn)\n", " pretanglants.append(\"-\".join(paratangle(talkEn)))\n", " if len(talkEn)>3:\n", " chainA12Y.append([\n", " talkEn.lower()[0],\n", " len(talkEn),\n", " talkEn.lower()[-1]\n", " ])\n", " else:\n", " chainA12Y.append([\n", " \"_\",\n", " talkEn.upper()\n", " ])\n", " chainA12Y.append(list(set(pretanglants)))\n", " return chainA12Y\n", "\n", "def prepQueries(safespellword, lang=\"pl\"):\n", "\n", " return [\n", " f\"https://{lang}.wikipedia.org/w/index.php?search={safespellword}\",\n", " f\"https://{lang}.wiktionary.org/w/index.php?search={safespellword}\",\n", " f\"https://{lang}.wikiquote.org/w/index.php?search={safespellword}\",\n", " f\"https://en.wikipedia.org/w/index.php?search={safespellword}\",\n", " f\"https://en.wiktionary.org/w/index.php?search={safespellword}\",\n", " f\"https://en.wikiquote.org/w/index.php?search={safespellword}\",\n", " f\"https://www.bing.com/search?q={safespellword}\",\n", " f\"https://search.yahoo.com/search?p={safespellword}\",\n", " f\"https://www.wikidata.org/w/index.php?search={safespellword}&language={lang}&title=Special%3ASearch\",\n", " f\"https://www.wikifunctions.org/w/index.php?search={safespellword}&title=Special:Search\",\n", " f\"https://oeis.org/search?q={safespellword}&go=Search\",\n", " f\"https://duckduckgo.com/?q={safespellword}&ia=web&assist=true\",\n", " f\"https://www.google.com/search?q={safespellword}\",\n", " f\"https://www.google.{lang}/search?q={safespellword}\",\n", " f\"https://translate.google.com/?sl={lang}&tl=en&text={safespellword}&op=translate\",\n", " f\"https://translate.google.{lang}/?sl={lang}&tl=en&text={safespellword}&op=translate\",\n", " f\"https://yandex.com/search/?text={safespellword}\",\n", " f\"https://search.brave.com/ask?q={safespellword}&source=web\",\n", " f\"https://search.brave.com/search?q={safespellword}&source=web\",\n", " f\"https://publicwww.com/q={safespellword}\",\n", " f\"https://publicwww.com/websites/{safespellword}/\"\n", " ]\n", "\n", "def getDefinitionTanglers(spellword, originLink):\n", " safestring = urllib.parse.quote(spellword)\n", " tanglers = [\n", " \"-\".join(paratangle(originLink))\n", " ]\n", " dataQueries = prepQueries(safestring)\n", " for link in dataQueries:\n", " tanglers.append(\"-\".join(paratangle(link)))\n", " return tanglers\n", " \n", "\n", "for link in linklist:\n", " urlObj = urllib.parse.urlsplit(link)\n", " if urlObj.netloc == \"sjp.pl\":\n", " print(urlObj)\n", " spellword = urllib.parse.unquote(urlObj.path[1:].split(\"/\")[0].split(\".\")[0], encoding='utf-8', errors='replace')\n", " print(spellword)\n", " # print(os.path.join(\n", " # os.getcwd(),\n", " # \"./wordbook\",\n", " # \".\"+urlObj.path+\n", " # ))\n", " localize = get_authenticity(spellword)\n", " print(localize)\n", " filenameword = f\"{'.'.join(localize[-1])}.WORD_PL.yml\"\n", " dict_entry = {\n", " \"word\":spellword,\n", " \"originlink\":link,\n", " \"queries\": prepQueries(urllib.parse.quote(spellword)),\n", " \"linktangles\": getDefinitionTanglers(spellword, link)\n", " }\n", " for pathing in localize[:-1]:\n", " spellscriptpath = os.path.join(\n", " os.getcwd(),\n", " \"./wordbook\",\n", " *[str(x) for x in pathing]\n", " )\n", " if not os.path.exists(spellscriptpath):\n", " os.makedirs(spellscriptpath)\n", " recordpath = os.path.join(spellscriptpath, filenameword)\n", " if not os.path.exists(recordpath):\n", " with open(recordpath, \"w\") as wordfile:\n", " wordfile.write(yaml.dump(dict_entry,Dumper=yaml.CDumper))\n", " \n", " # localize.append(\n", " \n", " # )\n", " #break\n", " \n", " \n", "#https://pl.wikipedia.org/wiki/Specjalna:Linkuj%C4%85ce/{word}\n", "#https://pl.wikipedia.org/wiki/Specjalna:Zmiany_w_linkowanych/{word}\n", "#https://pl.wiktionary.org/wiki/{word}\n", "#https://en.wiktionary.org/wiki/{word}\n", "#https://pl.wikipedia.org/w/index.php?search={word}\n", "#https://pl.wikipedia.org/w/index.php?search={word}&title=apokryf#Wsp%C3%B3%C5%82czesne_apokryfy\n", "#https://pl.wikipedia.org/wiki/{word}\n", "#https://pl.wikipedia.org/w/index.php?title={word}&action=history\n", "#https://pl.wikipedia.org/w/index.php?title={word}&feed=atom&action=history\n", "#https://pl.wikipedia.org/w/index.php?title={word}&action=info\n", "#https://www.wikidata.org/w/index.php?search={word}&language={lang}&title=Special%3ASearch&ns0=1\n", "#https://en.wikiquote.org/wiki/{word}\n", "#https://pl.wikiquote.org/wiki/{word}\n", "#https://pl.wikiquote.org/w/index.php?search={word}\n", "#https://en.wikibooks.org/wiki/Special:Search?search={word}&go=Go&ns0=1&ns4=1&ns102=1&ns110=1&ns112=1\n", "#https://www.wikifunctions.org/w/index.php?search={word}&title=Special:Search&ns0=1\n", "#https://duckduckgo.com/?q={word}&ia=web&assist=true\n", "#https://www.bing.com/search?q={word}\n", "#https://search.yahoo.com/search?p={word}\n", "#https://catalog.data.gov/dataset?q={word}\n", "#https://oeis.org/search?q={word}&language=english&go=Search\n", "#https://oeis.org/search?q={word}&language={lang}&go=Search\n", "#https://oeis.org/search?q={word}&go=Search\n", "#https://oeis.org/search?q={word}&sort=references\n", "#https://oeis.org/search?q={word}&start={pagination}&fmt=short&sort=number\n", "#https://www.virustotal.com/gui/search?query={urlstring}\n", "#https://www.virustotal.com/gui/search?query={urlstring}\n", "#https://urlscan.io/\n", "#https://cyscan.io/s/titcjv\n", "#https://www.urlert.com/" ] }, { "cell_type": "code", "execution_count": null, "id": "4dd92310", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.12" } }, "nbformat": 4, "nbformat_minor": 5 }