Skip to content

Commit

Permalink
Fixing empty content bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdanbobrowski committed Sep 6, 2024
1 parent 643cc54 commit daf8086
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
15 changes: 0 additions & 15 deletions blog2epub/blog2epub_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from urllib import parse
from urllib.error import URLError

import pkg_resources
from kivy.uix.anchorlayout import AnchorLayout # type: ignore
from kivy.uix.boxlayout import BoxLayout # type: ignore
from kivymd.uix.datatables import MDDataTable # type: ignore
Expand Down Expand Up @@ -305,19 +304,6 @@ def _update_tab_generate(self):
else:
self.generate_button.disabled = True

def _print_packages(self):
installed_packages = pkg_resources.working_set
installed_packages_list = sorted(
["%s==%s" % (i.key, i.version) for i in installed_packages]
)
if hasattr(self, "interface"):
self.interface.clear()
for pkg in installed_packages_list:
self.interface.print(pkg)
else:
for pkg in installed_packages_list:
logging.info(pkg)

def _define_tab_about(self):
self.tab_about = Tab(
title="About",
Expand All @@ -331,7 +317,6 @@ def _define_tab_about(self):
allow_stretch=True,
size_hint=(1, 0.7),
)
logo_image.bind(on_triple_tap=self._print_packages)
self.tab_about.add_widget(logo_image)
self.tab_about.add_widget(
MDLabel(
Expand Down
4 changes: 2 additions & 2 deletions blog2epub/crawlers/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import re

from lxml.html.soupparser import fromstring
from lxml.etree import tostring

from blog2epub.common.downloader import Downloader
import dateutil
Expand Down Expand Up @@ -221,8 +222,7 @@ def replace_images(self):
def get_content(self):
self.content = self.tree.xpath(self.content_xpath)
if len(self.content) == 1:
self.content = self.content[0]
self.content = str(self.content)
self.content = tostring(self.content[0]).decode("utf-8")
self.content = re.sub('style="[^"]*"', "", self.content)
self.content = re.sub('class="[^"]*"', "", self.content)
for src in re.findall('<iframe.+? src="([^?= ]*)', self.content):
Expand Down

0 comments on commit daf8086

Please sign in to comment.