Skip to content

Commit

Permalink
Split integration tests to separate files and add test for salam pax'…
Browse files Browse the repository at this point in the history
…s blog
  • Loading branch information
bohdanbobrowski committed Nov 19, 2024
1 parent 9054120 commit dbe5543
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
5 changes: 3 additions & 2 deletions blog2epub/crawlers/article_factory/blogspot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
class BlogspotArticleFactory(DefaultArticleFactory):
def get_title(self) -> Optional[str]:
title = super().get_title()
if self.blog_title is not None and title == self.blog_title:
title = "Pomidor"
date = self.get_date()
if self.blog_title is not None and title == self.blog_title and date is not None:
title = date.strftime("%A, %d %B %Y, %H:%M")
return title

def process(self) -> ArticleModel:
Expand Down
8 changes: 6 additions & 2 deletions blog2epub/crawlers/article_factory/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ def get_title(self) -> Optional[str]:
if title_pattern.xpath:
title = self.tree.xpath(title_pattern.xpath)
if len(title) > 1:
title = title[0]
title = html.unescape(title.strip())
title = html.unescape(title[0].strip())
break
while isinstance(title, list):
try:
title = title[0]
except IndexError:
title = None
return title

def get_date(self) -> Optional[datetime]:
Expand Down
27 changes: 26 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ click = "^8.1.7"
webencodings = "^0.5.1"
soupsieve = "^2.6"
pytz = "^2024.2"
ftfy = "^6.3.1"

[tool.poetry.group.docs.dependencies]
mkdocs = "^1.6.0"
Expand Down

0 comments on commit dbe5543

Please sign in to comment.