{"id":545,"date":"2024-01-17T20:12:08","date_gmt":"2024-01-17T20:12:08","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=545"},"modified":"2024-01-17T20:12:08","modified_gmt":"2024-01-17T20:12:08","slug":"building-a-generic-rss-parser-service-with-cloudflare-workers","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/building-a-generic-rss-parser-service-with-cloudflare-workers\/","title":{"rendered":"Building a Generic RSS Parser Service with Cloudflare Workers"},"content":{"rendered":"\n<p>One job you&#8217;re sure to do many, many times in your web development career is:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go get some data from a URL<\/li>\n\n\n\n<li>Parse it<\/li>\n\n\n\n<li>Return it<\/li>\n<\/ol>\n\n\n\n<p>If you&#8217;re lucky, the data is JSON because it&#8217;s such a ubiquitous and predictable data format that nearly any language can deal with it. But the data could be an RSS feed, which is a format for syndicating article-like data. I love RSS, but the format is generally XML not JSON, which is a bit harder to deal with. And <a href=\"https:\/\/www.raymondcamden.com\/2023\/10\/31\/building-a-generic-rss-parser-service-with-cloudflare-workers\">Raymond Camden has a good point<\/a>: <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>&#8230; the\u00a0<em>vast<\/em>\u00a0majority of RSS feeds don&#8217;t specify a CORS header to allow remote scripts to load them <\/p>\n<\/blockquote>\n\n\n\n<p>CORS is a browser-level protection that can be a pain to work around. Follow that link for Raymond&#8217;s great take on using a Cloudflare Worker (thus is server-side and doesn&#8217;t have CORS restrictions) to fetch and parse RSS. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>One job you&#8217;re sure to do many, many times in your web development career is: If you&#8217;re lucky, the data is JSON because it&#8217;s such a ubiquitous and predictable data format that nearly any language can deal with it. But the data could be an RSS feed, which is a format for syndicating article-like data. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":547,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[77,76,78],"class_list":["post-545","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-fetch","tag-json","tag-rss"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/01\/fetch-thumb.jpg?fit=1000%2C500&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=545"}],"version-history":[{"count":2,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/545\/revisions"}],"predecessor-version":[{"id":548,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/545\/revisions\/548"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/547"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}