Fix edge cases for evocati org
This commit is contained in:
parent
1e73c110da
commit
d2a18bf1cd
@ -2,14 +2,8 @@ from bs4 import BeautifulSoup
|
||||
import discord
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import requests
|
||||
import datetime
|
||||
from datetime import datetime
|
||||
|
||||
# prints for debug
|
||||
import pprint
|
||||
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
|
||||
wiki_url = "https://starcitizen.tools/"
|
||||
|
||||
@ -151,33 +145,32 @@ async def rsi_find(player):
|
||||
inline=False,
|
||||
)
|
||||
else:
|
||||
org_div = soup.find("div", class_="main-org right-col visibility-V")
|
||||
|
||||
org_div = soup.find("div", class_="main-org right-col visibility-V")
|
||||
org_url = base_url + org_div.findNext("a")["href"]
|
||||
org_div = soup.find(
|
||||
"div", class_=re.compile("main-org right-col visibility-[VH]")
|
||||
)
|
||||
org_url = base_url + org_div.find("div", class_="thumb").findNext("a")["href"]
|
||||
|
||||
org_response = requests.get(org_url).text
|
||||
org_soup = BeautifulSoup(org_response, "html.parser")
|
||||
|
||||
org_name = (
|
||||
org_div.find("span", string="Spectrum Identification (SID)")
|
||||
.findNext("strong")
|
||||
.text
|
||||
org_soup.find("div", class_="inner").findNext("span", class_="symbol").text
|
||||
)
|
||||
|
||||
org_rank = "N/A"
|
||||
try:
|
||||
org_rank = (
|
||||
org_div.find("span", string="Organization rank").findNext("strong").text
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
org_logo = (
|
||||
base_url
|
||||
+ org_soup.find("div", class_="logo noshadow").findNext("img")["src"]
|
||||
)
|
||||
org_member_count = (
|
||||
org_soup.find("div", class_="logo noshadow")
|
||||
.findNext("span", class_="count")
|
||||
.text
|
||||
base_url + org_soup.find("div", class_="inner").findNext("img")["src"]
|
||||
)
|
||||
|
||||
org_member_count = org_soup.find("span", class_="count").text
|
||||
|
||||
embed.add_field(name="-------", value="", inline=False)
|
||||
embed.add_field(
|
||||
name="Org Info",
|
||||
|
Loading…
x
Reference in New Issue
Block a user