mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-03-12 00:45:16 +00:00
Update fediverse.py
This commit is contained in:
parent
01d68c0100
commit
7d224047b8
|
@ -13,6 +13,7 @@
|
|||
import io
|
||||
import re
|
||||
import requests
|
||||
import os.path
|
||||
|
||||
from decouple import config
|
||||
from PIL import Image
|
||||
|
@ -22,16 +23,18 @@ from server import Filter
|
|||
try:
|
||||
truecaptcha_userid = config('TRUECAPTCHA_USERID') # truecaptcha.org
|
||||
truecaptcha_apikey = config('TRUECAPTCHA_APIKEY') # truecaptcha.org
|
||||
librey_apiurl = config("LIBREY_APIURL") # https://github.com/Ahwxorg/librey
|
||||
except
|
||||
pass
|
||||
dictionary_file = config('DICTIONARY_FILE', default='words_alpha.txt') # https://github.com/dwyl/english-words
|
||||
librey_apiurl = config('LIBREY_APIURL') # https://github.com/Ahwxorg/librey
|
||||
except Exception as e:
|
||||
print ("[*] Invaild configration: %s" % (str(e)))
|
||||
|
||||
class Fediverse(Filter):
|
||||
def __init__(self):
|
||||
# Load data to use KnownWords4 strategy
|
||||
# Download data: https://github.com/dwyl/english-words
|
||||
self.known_words = []
|
||||
with open("words_alpha.txt", "r") as file:
|
||||
if dictionary_file != '' and os.path.isfile(dictionary_file):
|
||||
with open(dictionary_file, "r") as file:
|
||||
words = file.readlines()
|
||||
self.known_words = [word.strip() for word in words if len(word.strip()) > 3]
|
||||
print ("[*] Data loaded to use KnownWords4 strategy")
|
||||
|
|
Loading…
Reference in New Issue
Block a user