Simplify the incident_url getting code and also change the image on /drug to be etam
This commit is contained in:
parent
cb556e87cd
commit
f9c03cb336
@ -52,7 +52,7 @@ class StarCitizen(commands.Cog):
|
|||||||
)
|
)
|
||||||
|
|
||||||
embed.set_thumbnail(
|
embed.set_thumbnail(
|
||||||
url="https://i.ebayimg.com/images/g/IvQAAOSwjyhaOTZN/s-l1200.webp"
|
url="https://media.starcitizen.tools/3/31/ViceCommodity_E%27tam.jpg"
|
||||||
)
|
)
|
||||||
embed.set_author(name="Ranking of drugs by sell price")
|
embed.set_author(name="Ranking of drugs by sell price")
|
||||||
|
|
||||||
@ -230,11 +230,12 @@ class StarCitizen(commands.Cog):
|
|||||||
status_json = requests.get(status_url + "/index.json").json()
|
status_json = requests.get(status_url + "/index.json").json()
|
||||||
|
|
||||||
if status_json["summaryStatus"] != "ok":
|
if status_json["summaryStatus"] != "ok":
|
||||||
# Look at all the systems in the API and filter out the ones whos "unresolvedIssues" list is not empty,
|
# Extract systems with unresolved issues
|
||||||
# Then parse out the "permalink" value
|
systems_with_issues = [system for system in status_json["systems"] if system["unresolvedIssues"]]
|
||||||
current_incident_url = list(
|
|
||||||
filter(lambda x: len(x["unresolvedIssues"]), status_json["systems"])
|
unresolved_issue_permalink = systems_with_issues[0]["unresolvedIssues"][0]["permalink"]
|
||||||
)[0]["unresolvedIssues"][0]["permalink"].replace("'", "")
|
# Remove any single quote characters from the URL
|
||||||
|
current_incident_url = unresolved_issue_permalink.replace("'", "")
|
||||||
|
|
||||||
response = requests.get(current_incident_url).text
|
response = requests.get(current_incident_url).text
|
||||||
incident_soup = BeautifulSoup(response, "html.parser")
|
incident_soup = BeautifulSoup(response, "html.parser")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user