Fix infinite addition of order:random

This commit is contained in:
Kat Inskip 2023-09-09 13:56:04 -07:00
parent adace2ec76
commit a3ff57bc21
Signed by: kat
GPG key ID: 465E64DECEA8CF0F

View file

@ -15,7 +15,8 @@ Turn a list of tags and a count into a list of URLs to download from
def request_posts(count: int, tags: list) -> list: def request_posts(count: int, tags: list) -> list:
logging.debug(f"request_posts() called with count={count}, tags=[{', '.join(tags)}]") logging.debug(f"request_posts() called with count={count}, tags=[{', '.join(tags)}]")
# Make sure we get a different result every time by using "order:random" as a tag # Make sure we get a different result every time by using "order:random" as a tag
tags.append("order:random") if "order:random" not in tags:
tags.append("order:random")
# Tags are separated by a plus sign for this API # Tags are separated by a plus sign for this API
tag_string: str = "+".join(tags) tag_string: str = "+".join(tags)
# Request URL for getting posts from the API # Request URL for getting posts from the API