mirror of
https://gitlab.com/MisterBiggs/discord-d2-bot.git
synced 2025-08-05 13:01:29 +00:00
init commit
This commit is contained in:
33
functions.py
Normal file
33
functions.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import requests
|
||||
import re
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
def xur_items(soup):
|
||||
items = []
|
||||
inventory = soup.select("#left-container > div.left-content > div > div > ul")[
|
||||
0
|
||||
].find_all("a")
|
||||
|
||||
for item in inventory:
|
||||
items.append({"name": item.contents[0], "link": item.get("href")})
|
||||
|
||||
return items
|
||||
|
||||
|
||||
def xur_location(soup):
|
||||
# Get URL of image
|
||||
img_url = soup.select("#left-container > div.left-content > div > div > a > img")[
|
||||
0
|
||||
].get("src")
|
||||
|
||||
# Get Item Description
|
||||
description = soup.select("#left-container > div.left-content > div > div > p")[
|
||||
-1
|
||||
].contents[0]
|
||||
|
||||
return {
|
||||
"img_url": img_url,
|
||||
"description": description,
|
||||
}
|
||||
|
Reference in New Issue
Block a user