fix: [Onion module] fix kvrocks sismeber

This commit is contained in:
Terrtia 2023-05-15 10:42:46 +02:00
parent 2ae3ffd6d2
commit 7669c16c74
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -267,7 +267,11 @@ class Cookiejar:
r_crawler.hset(f'cookiejar:meta:{self.uuid}', 'level', level) r_crawler.hset(f'cookiejar:meta:{self.uuid}', 'level', level)
def is_cookie_in_jar(self, cookie_uuid): def is_cookie_in_jar(self, cookie_uuid):
# kvrocks sismember TEMP fix
try:
return r_crawler.sismember(f'cookiejar:cookies:{self.uuid}', cookie_uuid) return r_crawler.sismember(f'cookiejar:cookies:{self.uuid}', cookie_uuid)
except:
return False
def get_cookies_uuid(self): def get_cookies_uuid(self):
return r_crawler.smembers(f'cookiejar:cookies:{self.uuid}') return r_crawler.smembers(f'cookiejar:cookies:{self.uuid}')
@ -677,7 +681,11 @@ def get_blacklist():
return r_crawler.smembers('blacklist:domain') return r_crawler.smembers('blacklist:domain')
def is_blacklisted_domain(domain): def is_blacklisted_domain(domain):
# kvrocks sismember TEMP fix
try:
return r_crawler.sismember('blacklist:domain', domain) return r_crawler.sismember('blacklist:domain', domain)
except:
return False
def blacklist_domain(domain): def blacklist_domain(domain):
return r_crawler.sadd('blacklist:domain', domain) return r_crawler.sadd('blacklist:domain', domain)