Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions markdown_crawler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,15 @@ def get_target_content(
# ---------------------------
else:
max_text_length = 0
ok = False
for tag in soup.find_all(DEFAULT_TARGET_CONTENT):
text_length = len(tag.get_text())
if text_length > max_text_length:
max_text_length = text_length
main_content = tag
ok = True

content = str(main_content)
content = str(main_content) if ok else ""

return content if len(content) > 0 else False

Expand Down Expand Up @@ -356,4 +358,4 @@ def md_crawl(
for t in threads:
t.join()

logger.info('🏁 All threads have finished')
logger.info('🏁 All threads have finished')