Has anyone made this and subbed out the carrots for parsnips? Making for Thanksgiving and my SIL is bringing a carrot side dish so want to change up the veggies. Or can just omit them, but assuming that the carrots bring something to the sauce I don’t want to entirely miss.
version ai :
python
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin
def get_full_article_html(url):
try:
# Fetch the content, allowing redirects
response = requests.get(url, timeout=10)
response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx)
# The base URL should be the final URL after any redirects
base_url = response.url
soup = BeautifulSoup(response.text, ‘html.parser’)
# Find the main article content. On Smitten Kitchen, it’s typically within an
article_content = soup.find(‘article’)
if not article_content:
return “”
# Make all relative URLs absolute for images and links within the article
for tag in article_content.find_all([‘img’, ‘a’]):
if tag.name == ‘img’ and ‘src’ in tag.attrs:
tag[‘src’] = urljoin(base_url, tag[‘src’])
elif tag.name == ‘a’ and ‘href’ in tag.attrs:
tag[‘href’] = urljoin(base_url, tag[‘href’])
# Also handle srcset for responsive images if desired, though often not strictly necessary for basic display
if tag.name == ‘img’ and ‘srcset’ in tag.attrs:
srcset_values = []
for src_descriptor in tag[‘srcset’].split(‘,’):
src, *descriptor = src_descriptor.strip().split(‘ ‘)
absolute_src = urljoin(base_url, src)
srcset_values.append(f”{absolute_src} {‘ ‘.join(descriptor)}”)
tag[‘srcset’] = ‘, ‘.join(srcset_values)
# Return the modified article HTML
return str(article_content)
except requests.exceptions.RequestException as e:
return f””
except Exception as e:
return f””
if __name__ == ‘__main__’:
target_url = “https://smittenkitchen.com/2025/04/simplest-brisket-with-braised-onions/#comment-2714096”
final_article_html = get_full_article_html(target_url)
print(final_article_html)
