dragon-bot/app/tarkov.py

12 lines
401 B
Python

from bs4 import BeautifulSoup
import requests
def request_wiki(url, heading):
response = requests.get(
"https://escapefromtarkov.fandom.com/wiki/Category:" + url, timeout=25
).text
soup = BeautifulSoup(response, "html.parser")
h2_heading = soup.find(f"h2", string=f'Pages in category "{heading}"')
return [link.text for link in h2_heading.find_next("div").find_all("a")]