Skip to content

Commit a7ea280

Browse files
committed
🐛 Fix listings scripts
1 parent 44d851e commit a7ea280

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

scripts/check_listings/listings/DiscordsCom.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ async def fetch_raw_description(self):
1919
description = await page.select("app-bot-page-description")
2020
html = await description.get_html()
2121
soup = BeautifulSoup(html, "html.parser")
22+
2223
text = self.normalize_soup(soup)
2324
if not text:
2425
raise NotFoundError("Listing not found")

scripts/check_listings/listings/DisforgeCom.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import nodriver as uc
22

33
from bs4 import BeautifulSoup
4-
from asyncio import TimeoutError
5-
4+
from markdown import markdown
65
from .Listing import Listing, NotFoundError
76

87

@@ -15,12 +14,20 @@ def __init__(self, browser: uc.Browser, url: str):
1514

1615
async def fetch_raw_description(self):
1716
page = await self.browser.get(self.url)
17+
await page.wait(4)
1818
# if the window location is homepage, then the bot is not found
19-
if len(await page.find_elements_by_text("Add this bot", tag_hint="a")) == 0:
19+
if (
20+
len(await page.find_elements_by_text("Vote for this bot", tag_hint="a"))
21+
== 0
22+
):
2023
raise NotFoundError("Listing not found")
2124
description = await page.select(".card-body")
2225
html = await description.get_html()
2326
soup = BeautifulSoup(html, "html.parser")
27+
# get the second p direct child as that is the actual description. but get it as soup
28+
soup = soup.select("p")[1]
29+
html = markdown(soup.text)
30+
soup = BeautifulSoup(html, "html.parser")
2431
text = self.normalize_soup(soup)
2532
if not text:
2633
raise NotFoundError("Listing not found")

0 commit comments

Comments
 (0)