dragon-bot/app/warframe.py
Luke R 547d4677c9
All checks were successful
Build and push / changes (push) Successful in 41s
Build and push / Lint-Python (push) Successful in 12s
Build and push / Build-and-Push-Docker (push) Successful in 1m53s
Build and push / sync-argocd-app (push) Successful in 9s
Adding trader reset command to the bot
2024-10-17 15:03:14 -07:00

21 lines
773 B
Python
Executable File

from bs4 import BeautifulSoup
import queue
import requests
def query_wiki(letter, q: queue.Queue):
"""
returns a list of all ships in the game, which can then be passed to the /ship command for auto complete
"""
# Step through the alphabet, and query each page
url = f"https://warframe.fandom.com/wiki/Category:Mods?from={letter}"
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
# Find the div element with the specified class
div_element = soup.find("div", {"class": "category-page__members"}).find_all("li")
# add them all to the main list
q.put([li.text.strip() for li in div_element if "Category" not in li.text])
return sorted([item for sublist in list(q.queue) for item in sublist])