{"id":2471,"date":"2026-03-13T08:35:02","date_gmt":"2026-03-13T08:35:02","guid":{"rendered":"https:\/\/www.cupcakerecipe.net\/?p=2471"},"modified":"2026-03-13T08:35:02","modified_gmt":"2026-03-13T08:35:02","slug":"by-megan","status":"publish","type":"post","link":"https:\/\/www.cupcakerecipe.net\/?p=2471","title":{"rendered":"By: Megan"},"content":{"rendered":"<p>I made these for my family tonight and they were wildly delicious. I used tapioca starch instead of potato starch; worked great. We ate them with over easy eggs and salsa and my son and my husband fought over the last ones. I&#8217;ll be making them again.<\/p>\n<p> version ai :<br \/>\npython<br \/>\nimport requests<br \/>\nfrom bs4 import BeautifulSoup<br \/>\nfrom urllib.parse import urljoin, urlparse<\/p>\n<p>def get_full_article_html(article_url_with_anchor):<br \/>\n    &#8220;&#8221;&#8221;<br \/>\n    Fetches the full HTML content of an article from the given URL,<br \/>\n    ensuring all image links (src and srcset) are absolute.<br \/>\n    &#8220;&#8221;&#8221;<br \/>\n    # Strip any anchor from the URL to get the base article URL for fetching<br \/>\n    parsed_input_url = urlparse(article_url_with_anchor)<br \/>\n    base_article_fetch_url = f&#8221;{parsed_input_url.scheme}:\/\/{parsed_input_url.netloc}{parsed_input_url.path}&#8221;<\/p>\n<p>    try:<br \/>\n        response = requests.get(base_article_fetch_url)<br \/>\n        response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)<\/p>\n<p>        soup = BeautifulSoup(response.text, &#8216;html.parser&#8217;)<\/p>\n<p>        # Smitten Kitchen articles are typically within an <\/p>\n<article> tag with an ID like &#8220;post-XXXX&#8221;<br \/>\n        article_element = soup.find(&#8216;article&#8217;, id=lambda x: x and x.startswith(&#8216;post-&#8216;))<\/p>\n<p>        if not article_element:<br \/>\n            # Fallback to the main content div if the specific article tag isn&#8217;t found<br \/>\n            # This is less ideal as it might miss the title\/header, but provides core content<br \/>\n            article_element = soup.find(&#8216;div&#8217;, class_=&#8217;entry-content&#8217;)<br \/>\n            if not article_element:<br \/>\n                # If neither is found, return an indicator that content could not be extracted<br \/>\n                return &#8220;<!-- Could not find main article content on the page. Please check the URL or page structure. -->&#8221;<\/p>\n<p>        # Determine the base URL (scheme:\/\/netloc) for resolving relative paths<br \/>\n        # This ensures links point back to the original site.<br \/>\n        base_url_for_links = f&#8221;{parsed_input_url.scheme}:\/\/{parsed_input_url.netloc}&#8221;<\/p>\n<p>        # Iterate through all <img> tags within the extracted article content<br \/>\n        for img in article_element.find_all(&#8216;img&#8217;):<br \/>\n            # Handle &#8216;src&#8217; attribute: make it an absolute URL<br \/>\n            src = img.get(&#8216;src&#8217;)<br \/>\n            if src:<br \/>\n                img[&#8216;src&#8217;] = urljoin(base_url_for_links, src)<\/p>\n<p>            # Handle &#8216;srcset&#8217; attribute: make all URLs within it absolute<br \/>\n            srcset = img.get(&#8216;srcset&#8217;)<br \/>\n            if srcset:<br \/>\n                new_srcset_parts = []<br \/>\n                # srcset can contain multiple image URLs with optional descriptors (e.g., &#8220;url 100w, url 1.5x&#8221;)<br \/>\n                for part in srcset.split(&#8216;,&#8217;):<br \/>\n                    part = part.strip()<br \/>\n                    if not part:<br \/>\n                        continue # Skip empty parts that might result from splitting<\/p>\n<p>                    # Split the URL from its descriptor (e.g., &#8216;768w&#8217; or &#8216;1.5x&#8217;)<br \/>\n                    url_and_desc = part.split(&#8216; &#8216;, 1)<br \/>\n                    img_url = url_and_desc[0]<\/p>\n<p>                    # Make the image URL absolute<br \/>\n                    abs_img_url = urljoin(base_url_for_links, img_url)<\/p>\n<p>                    # Reconstruct the srcset part with the absolute URL<br \/>\n                    if len(url_and_desc) > 1:<br \/>\n                        # If a descriptor was present, include it<br \/>\n                        new_srcset_parts.append(f&#8221;{abs_img_url} {url_and_desc[1]}&#8221;)<br \/>\n                    else:<br \/>\n                        # Otherwise, just the absolute URL<br \/>\n                        new_srcset_parts.append(abs_img_url)<\/p>\n<p>                # Update the srcset attribute if there are valid parts<br \/>\n                if new_srcset_parts:<br \/>\n                    img[&#8216;srcset&#8217;] = &#8216;, &#8216;.join(new_srcset_parts)<\/p>\n<p>        # Return the HTML of the modified article element as a string<br \/>\n        return str(article_element)<\/p>\n<p>    except requests.exceptions.RequestException as e:<br \/>\n        # Catch network-related errors (e.g., connection refused, timeout, HTTP errors)<br \/>\n        return f&#8221;<!-- Error fetching URL {base_article_fetch_url}: {e} -->&#8221;<br \/>\n    except Exception as e:<br \/>\n        # Catch any other unexpected errors during parsing or processing<br \/>\n        return f&#8221;<!-- An unexpected error occurred while processing the article: {e} -->&#8221;<\/p>\n<p># The URL provided by the user, including the comment anchor<br \/>\nuser_provided_url = &#8220;https:\/\/smittenkitchen.com\/2023\/04\/hash-brown-patties\/#comment-2691402&#8221;<\/p>\n<p># Get the full article HTML with corrected image links<br \/>\nfinal_article_html = get_full_article_html(user_provided_url)<\/p>\n<p># Print the result without any additional explanation or formatting<br \/>\nprint(final_article_html)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I made these for my family tonight and they were wildly delicious. I used tapioca starch instead of potato starch; worked great. We ate them with over easy eggs and salsa and my son and my husband fought over the last ones. I&#8217;ll be making them again. version ai : python import requests from bs4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wprm-recipe-roundup-name":"","wprm-recipe-roundup-description":"","iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-2471","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-uncategorized"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.6 (Yoast SEO v26.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>By: Megan - cupcake recipe<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"By: Megan\" \/>\n<meta property=\"og:description\" content=\"I made these for my family tonight and they were wildly delicious. I used tapioca starch instead of potato starch; worked great. We ate them with over easy eggs and salsa and my son and my husband fought over the last ones. I&#8217;ll be making them again. version ai : python import requests from bs4 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cupcakerecipe.net\/?p=2471\" \/>\n<meta property=\"og:site_name\" content=\"cupcake recipe\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-13T08:35:02+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.cupcakerecipe.net\/?p=2471#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.cupcakerecipe.net\/?p=2471\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.cupcakerecipe.net\/#\/schema\/person\/eeb0f97aec73d7100df65b40b182044d\"},\"headline\":\"By: Megan\",\"datePublished\":\"2026-03-13T08:35:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.cupcakerecipe.net\/?p=2471\"},\"wordCount\":567,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.cupcakerecipe.net\/?p=2471#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.cupcakerecipe.net\/?p=2471\",\"url\":\"https:\/\/www.cupcakerecipe.net\/?p=2471\",\"name\":\"By: Megan - cupcake recipe\",\"isPartOf\":{\"@id\":\"https:\/\/www.cupcakerecipe.net\/#website\"},\"datePublished\":\"2026-03-13T08:35:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.cupcakerecipe.net\/#\/schema\/person\/eeb0f97aec73d7100df65b40b182044d\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.cupcakerecipe.net\/?p=2471#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.cupcakerecipe.net\/?p=2471\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.cupcakerecipe.net\/?p=2471#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.cupcakerecipe.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"By: Megan\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.cupcakerecipe.net\/#website\",\"url\":\"https:\/\/www.cupcakerecipe.net\/\",\"name\":\"cupcake recipe\",\"description\":\"Baking and dessert recipes for cupcakes, cakes, muffins, pies, and everything in between - from perfected classics to new and adventurous indulgences.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.cupcakerecipe.net\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.cupcakerecipe.net\/#\/schema\/person\/eeb0f97aec73d7100df65b40b182044d\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.cupcakerecipe.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/fa5a40e10f358e78b5b5a39b5fecc35f4c68f82c33a6fe8a71482b6be3838c69?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/fa5a40e10f358e78b5b5a39b5fecc35f4c68f82c33a6fe8a71482b6be3838c69?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/cupcakerecipe.net\"],\"url\":\"https:\/\/www.cupcakerecipe.net\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"By: Megan - cupcake recipe","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"By: Megan","og_description":"I made these for my family tonight and they were wildly delicious. I used tapioca starch instead of potato starch; worked great. We ate them with over easy eggs and salsa and my son and my husband fought over the last ones. I&#8217;ll be making them again. version ai : python import requests from bs4 [&hellip;]","og_url":"https:\/\/www.cupcakerecipe.net\/?p=2471","og_site_name":"cupcake recipe","article_published_time":"2026-03-13T08:35:02+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cupcakerecipe.net\/?p=2471#article","isPartOf":{"@id":"https:\/\/www.cupcakerecipe.net\/?p=2471"},"author":{"name":"admin","@id":"https:\/\/www.cupcakerecipe.net\/#\/schema\/person\/eeb0f97aec73d7100df65b40b182044d"},"headline":"By: Megan","datePublished":"2026-03-13T08:35:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cupcakerecipe.net\/?p=2471"},"wordCount":567,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.cupcakerecipe.net\/?p=2471#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.cupcakerecipe.net\/?p=2471","url":"https:\/\/www.cupcakerecipe.net\/?p=2471","name":"By: Megan - cupcake recipe","isPartOf":{"@id":"https:\/\/www.cupcakerecipe.net\/#website"},"datePublished":"2026-03-13T08:35:02+00:00","author":{"@id":"https:\/\/www.cupcakerecipe.net\/#\/schema\/person\/eeb0f97aec73d7100df65b40b182044d"},"breadcrumb":{"@id":"https:\/\/www.cupcakerecipe.net\/?p=2471#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cupcakerecipe.net\/?p=2471"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.cupcakerecipe.net\/?p=2471#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cupcakerecipe.net\/"},{"@type":"ListItem","position":2,"name":"By: Megan"}]},{"@type":"WebSite","@id":"https:\/\/www.cupcakerecipe.net\/#website","url":"https:\/\/www.cupcakerecipe.net\/","name":"cupcake recipe","description":"Baking and dessert recipes for cupcakes, cakes, muffins, pies, and everything in between - from perfected classics to new and adventurous indulgences.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cupcakerecipe.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.cupcakerecipe.net\/#\/schema\/person\/eeb0f97aec73d7100df65b40b182044d","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cupcakerecipe.net\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/fa5a40e10f358e78b5b5a39b5fecc35f4c68f82c33a6fe8a71482b6be3838c69?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fa5a40e10f358e78b5b5a39b5fecc35f4c68f82c33a6fe8a71482b6be3838c69?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/cupcakerecipe.net"],"url":"https:\/\/www.cupcakerecipe.net\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=\/wp\/v2\/posts\/2471","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2471"}],"version-history":[{"count":0,"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=\/wp\/v2\/posts\/2471\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cupcakerecipe.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}