Skip to content

Commit

Permalink
fix(ascii2d): fix parsing logic for title
Browse files Browse the repository at this point in the history
  • Loading branch information
NekoAria committed Jul 13, 2023
1 parent c02e8e8 commit b919332
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions PicImageSearch/model/ascii2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ def _arrange_links(self, infos: PyQuery, links: PyQuery, mark: str) -> None:

def _arrange_title(self, infos: PyQuery) -> None:
if not self.title:
self.title = infos.find("h6").text() or self._extract_external_text(infos)
self.title = self._extract_external_text(infos) or infos.find("h6").text()
if self.title and any(i in self.title for i in {"詳細掲示板のログ", "2ちゃんねるのログ"}):
self.title = ""

@staticmethod
def _extract_external_text(infos: PyQuery) -> str:
external = infos.find("div.external")
external = infos.find(".external")
external.remove("a")
return external.text() or ""
return "\n".join((i.text() for i in external.items() if i.text())) or ""

def _normalize_url_list(self) -> None:
self.url_list = [
Expand Down

0 comments on commit b919332

Please sign in to comment.