Skip to content

Commit

Permalink
Fix bug in webtoon css selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
zGadli committed Apr 6, 2024
1 parent 2a8db5f commit 25206b3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sources/en/w/webtoon.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class WebToonsCrawler(Crawler):
has_manga = True
base_url = ["https://www.webtoons.com/"]

search_url = "%ssearch?keyword=%s"
search_url = "%s/en/search?keyword=%s"

def initialize(self) -> None:
self.cleaner.bad_tags.update(["h3"])
Expand All @@ -28,7 +28,7 @@ def search_novel(self, query):
results = []
for tab in soup.select("ul.card_lst li"):
a = tab.select_one("a")
title = tab.select_one("p.subj")
title = tab.select_one("p.subj").get_text()
results.append(
{
"title": title,
Expand All @@ -38,7 +38,7 @@ def search_novel(self, query):

for tab in soup1.select("div.challenge_lst.search ul"):
a = tab.select_one("a.challenge_item")
title = tab.select_one("p.subj")
title = tab.select_one("p.subj").get_text()
results.append(
{
"title": title,
Expand All @@ -53,6 +53,8 @@ def read_novel_info(self): # need to check if there is only 1 pagination
soup = self.get_soup(self.novel_url)

possible_title = soup.select_one("h1.subj")
if possible_title is None:
possible_title = soup.select_one("h3.subj")
self.novel_title = possible_title.text.strip()
logger.info("Novel title: %s", self.novel_title)

Expand Down

0 comments on commit 25206b3

Please sign in to comment.