Updated tag system. Banned tags must now match exactly
This commit is contained in:
parent
0511d2fc54
commit
dfbbbc7f22
@ -28,11 +28,9 @@ def random_tag(*tags):
|
||||
|
||||
|
||||
def collect_tags(post):
|
||||
tag_response = []
|
||||
for tag_type in "tag_string", "tag_string_general":
|
||||
if tag_type in post:
|
||||
tag_response.append(post[tag_type].strip())
|
||||
return " ".join(tag_response)
|
||||
possible_tag_keys = ("tag_string", "tag_string_general")
|
||||
tag_response = [post[key].strip() for key in possible_tag_keys if key in post]
|
||||
return " ".join(tag_response).lower().split()
|
||||
|
||||
|
||||
|
||||
|
@ -29,8 +29,7 @@ def random_tag(*tags):
|
||||
|
||||
|
||||
def collect_tags(post):
|
||||
return post["tags"].strip()
|
||||
|
||||
return post["tags"].strip().lower().split()
|
||||
|
||||
|
||||
def is_banned(post, profile):
|
||||
@ -38,6 +37,7 @@ def is_banned(post, profile):
|
||||
tag_banned = profile["banned_tags"]
|
||||
for tag in tag_banned:
|
||||
if tag in tag_response:
|
||||
print(tag)
|
||||
return tag
|
||||
return None
|
||||
|
||||
|
@ -29,12 +29,7 @@ def random_tag(*tags):
|
||||
|
||||
|
||||
def collect_tags(post):
|
||||
tag_response = []
|
||||
for tag_type in "tag_string", "tag_string_general":
|
||||
if tag_type in post:
|
||||
tag_response.append(post[tag_type].strip())
|
||||
return " ".join(tag_response)
|
||||
|
||||
return post["tags"].strip().lower().split()
|
||||
|
||||
|
||||
def is_banned(post, profile):
|
||||
@ -46,7 +41,6 @@ def is_banned(post, profile):
|
||||
return None
|
||||
|
||||
|
||||
|
||||
def get_nsfw(post):
|
||||
return post["rating"] in ("q", "e")
|
||||
|
||||
@ -122,7 +116,6 @@ class downloader:
|
||||
|
||||
def search(self, search_url):
|
||||
search_request = None
|
||||
print(search_url)
|
||||
if self.username and self.password:
|
||||
search_request = requests.get(search_url,
|
||||
auth=(self.username, self.password)
|
||||
|
Reference in New Issue
Block a user