# Path: common_utils.py
# def fetch_html_page(page_url):
#     user_agent = (
#         "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) "
#         "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36"
#     )
#     headers = {"User-Agent": user_agent}
#     page = requests.get(page_url, headers=headers, timeout=10)
#     return page.text
# 
# def html_parser_from(page_html):
#     return BeautifulSoup(page_html, "html.parser")


import logging
import os
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from datetime import datetime
from pathlib import Path
from urllib.parse import parse_qs, urlparse
from bs4 import BeautifulSoup
from py_executable_checklist.workflow import WorkflowBase, run_command, run_workflow
from common_utils import fetch_html_page, html_parser_from
#!/usr/bin/env python3
r"""
Grab links from HN Post and generate Markdown post with image thumbnails
It also creates a Hugo blog post from Markdown and images generated


# Path: common_utils.py
# def fetch_html_page(page_url):
#     user_agent = (
#         "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) "
#         "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36"
#     )
#     headers = {"User-Agent": user_agent}
#     page = requests.get(page_url, headers=headers, timeout=10)
#     return page.text
# 
# def html_parser_from(page_html):
#     return BeautifulSoup(page_html, "html.parser")


# Path: hn_links.py
import logging
import os
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from datetime import datetime
from pathlib import Path
from urllib.parse import parse_qs, urlparse
from bs4 import BeautifulSoup
from py_executable_checklist.workflow import WorkflowBase, run_command, run_workflow
from common_utils import fetch_html_page, html_parser_from

#!/usr/bin/env python3
r"""
Grab links from HN Post and generate Markdown post with image thumbnails
It also creates a Hugo blog post from Markdown and images generated


SUPPORT: To regenerate thumbnail, just delete the image file under thumbnails folder inside the post directory.