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
4 changes: 2 additions & 2 deletions scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def save_post(self, post, output_dir, html_only=False, md_only=False):

# We save the modified soup with local image links
full_html = f"<html><head><title>{title}</title>{css}</head><body><h1>{title}</h1>{soup.prettify()}</body></html>"
with open(os.path.join(output_dir, f"{filename_base}.html"), 'w') as f:
with open(os.path.join(output_dir, f"{filename_base}.html"), 'w', encoding='utf-8') as f:
f.write(full_html)

# 2. Save Markdown (if not disabled)
Expand All @@ -228,7 +228,7 @@ def save_post(self, post, output_dir, html_only=False, md_only=False):
# Add metadata header
full_md = f"# {title}\n\nDate: {date}\nURL: {self.base_url}/p/{slug}\n\n{md_content}"

with open(os.path.join(output_dir, f"{filename_base}.md"), 'w') as f:
with open(os.path.join(output_dir, f"{filename_base}.md"), 'w', encoding='utf-8') as f:
f.write(full_md)


Expand Down