Spaces:
Paused
Paused
Delete wordlist.py
Browse files- wordlist.py +0 -33
wordlist.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
| 1 |
-
# ββββββββββββββββββββββββββββββββββββββββ
|
| 2 |
-
# FILE: wordlist.py
|
| 3 |
-
# ββββββββββββββββββββββββββββββββββββββββ
|
| 4 |
-
|
| 5 |
-
import asyncio
|
| 6 |
-
import urllib.request
|
| 7 |
-
import config
|
| 8 |
-
|
| 9 |
-
def _download_and_filter() -> list[str]:
|
| 10 |
-
try:
|
| 11 |
-
req = urllib.request.Request(config.WORDLIST_URL)
|
| 12 |
-
with urllib.request.urlopen(req) as response:
|
| 13 |
-
data = response.read().decode('utf-8')
|
| 14 |
-
|
| 15 |
-
words = []
|
| 16 |
-
for line in data.splitlines():
|
| 17 |
-
line = line.strip()
|
| 18 |
-
if not line:
|
| 19 |
-
continue
|
| 20 |
-
parts = line.split('\t')
|
| 21 |
-
if not parts:
|
| 22 |
-
continue
|
| 23 |
-
w = parts[0].strip().lower()
|
| 24 |
-
if w.isalpha() and config.MIN_WORD_LEN <= len(w) <= config.MAX_WORD_LEN:
|
| 25 |
-
words.append(w)
|
| 26 |
-
return words
|
| 27 |
-
except Exception as e:
|
| 28 |
-
print(f"Error fetching wordlist: {e}")
|
| 29 |
-
return []
|
| 30 |
-
|
| 31 |
-
async def fetch_word_list() -> list[str]:
|
| 32 |
-
loop = asyncio.get_running_loop()
|
| 33 |
-
return await loop.run_in_executor(None, _download_and_filter)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|