1
0
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:
2020-01-03 16:32:11 -07:00
parent e430238a21
commit b1e9b5c242
5 changed files with 263 additions and 0 deletions

33
functions.py Normal file
View 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,
}