Listen to Podcasts
+Loading podcasts...
+From a81d9d04d79967bbf64a96d38ffff8a666cd732d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 19:16:20 +0000 Subject: [PATCH] feat: integrate environmental podcast page - Created podcast.html, podcast.css, and podcast.js to fetch and display podcasts from the iTunes Search API. - Updated index.html to include a link to the new podcast section. - Ensured security by using textContent for dynamic content rendering. - Verified functionality with Playwright and existing backend tests. Co-authored-by: GYFX35 <134739293+GYFX35@users.noreply.github.com> --- eco_project/backend/static/index.html | 1 + eco_project/backend/static/podcast.css | 60 +++++++++++++++++++++++ eco_project/backend/static/podcast.html | 32 +++++++++++++ eco_project/backend/static/podcast.js | 63 +++++++++++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 eco_project/backend/static/podcast.css create mode 100644 eco_project/backend/static/podcast.html create mode 100644 eco_project/backend/static/podcast.js diff --git a/eco_project/backend/static/index.html b/eco_project/backend/static/index.html index 229b2f6..ca8aaee 100644 --- a/eco_project/backend/static/index.html +++ b/eco_project/backend/static/index.html @@ -57,6 +57,7 @@
Loading podcasts...
+No podcasts found.
'; + return; + } + + data.results.forEach(podcast => { + const podcastCard = document.createElement('div'); + podcastCard.classList.add('podcast-card'); + + const img = document.createElement('img'); + img.src = podcast.artworkUrl600 || podcast.artworkUrl100; + img.alt = podcast.collectionName; + + const h3 = document.createElement('h3'); + h3.textContent = podcast.collectionName; + + const artistP = document.createElement('p'); + artistP.innerHTML = `Artist: `; + const artistSpan = document.createElement('span'); + artistSpan.textContent = podcast.artistName; + artistP.appendChild(artistSpan); + + const genreP = document.createElement('p'); + genreP.innerHTML = `Genre: `; + const genreSpan = document.createElement('span'); + genreSpan.textContent = podcast.primaryGenreName; + genreP.appendChild(genreSpan); + + const link = document.createElement('a'); + link.href = podcast.collectionViewUrl; + link.target = "_blank"; + link.textContent = "View on Apple Podcasts"; + + podcastCard.appendChild(img); + podcastCard.appendChild(h3); + podcastCard.appendChild(artistP); + podcastCard.appendChild(genreP); + podcastCard.appendChild(link); + + podcastContainer.appendChild(podcastCard); + }); + }) + .catch(error => { + console.error('There has been a problem with your fetch operation:', error); + podcastContainer.innerHTML = 'Could not fetch podcast data. Please try again later.
'; + }); +});