{"id":170,"date":"2026-04-10T14:14:26","date_gmt":"2026-04-10T14:14:26","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/d_eanes\/?p=170"},"modified":"2026-04-10T14:14:26","modified_gmt":"2026-04-10T14:14:26","slug":"free-friday-4-10-26","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/d_eanes\/2026\/04\/10\/free-friday-4-10-26\/","title":{"rendered":"Free Friday: 4\/10\/26"},"content":{"rendered":"\n<p>Today I updated my NASA Space Dashboard to better handle the APOD. While the website previously worked for photos, I\u2019ve now added the logic needed to support videos and descriptions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fetch(\"https:\/\/api.nasa.gov\/planetary\/apod...\")<\/code><\/pre>\n\n\n\n<p>^This hits the NASA API, retrieves the daily data, and selects the correct HTML elements to inject the content into. I also ensured the apodTitle and apodDesc update every time so the user can read the context behind the visuals.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (data.media_type === \"image\")<\/code><\/pre>\n\n\n\n<p>^This check handles the standard case. If the API returns an image, the app creates an  element, sets the source, and rounds the corners to match the dashboard&#8217;s aesthetic.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (data.url.endsWith(\".mp4\"))<\/code><\/pre>\n\n\n\n<p>^I added this specifically for NASA-hosted video files. It creates a native player with user controls, making sure the video spans the full width of the section.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function getEmbedUrl(url)<\/code><\/pre>\n\n\n\n<p>^Since many APOD updates are actually youTube or Vimeo links, I wrote this helper function. It detects &#8220;watch&#8221; links and converts them into &#8220;embed&#8221; links so they can actually play inside an iframe on my site without being blocked.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"950\" height=\"817\" src=\"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/04\/Screenshot-2026-04-10-101337.png\" alt=\"\" class=\"wp-image-171\" srcset=\"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/04\/Screenshot-2026-04-10-101337.png 950w, https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/04\/Screenshot-2026-04-10-101337-300x258.png 300w, https:\/\/theroyalscode.com\/students\/d_eanes\/wp-content\/uploads\/2026\/04\/Screenshot-2026-04-10-101337-768x660.png 768w\" sizes=\"auto, (max-width: 950px) 100vw, 950px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Today I updated my NASA Space Dashboard to better handle the APOD. While the website previously worked for photos, I\u2019ve now added the logic needed to support videos and descriptions. ^This hits the NASA API, retrieves the daily data, and selects the correct HTML elements to inject the content into. I also ensured the apodTitle&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-170","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/posts\/170","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/comments?post=170"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/posts\/170\/revisions"}],"predecessor-version":[{"id":172,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/posts\/170\/revisions\/172"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/media?parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/categories?post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/d_eanes\/wp-json\/wp\/v2\/tags?post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}