Skip to content

Support embedded HTML5 <video> tags #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jsolly
Copy link

@jsolly jsolly commented May 19, 2025

Adjust media_type detection to include embedded

The API fails with at least one type of APOD. Today's APOD, May 18th 2024 is an embedded html5 < video >. The utility.py doesn't recognize it cause it's expecting videos to be iframes.

This new elif statement fixes the media_type and url for APODs that are HTML5 videos embedded directly in the HTML.

Before

{
  "date": "2025-05-18",
  "explanation": "What if you could fly over Pluto -- what might you see? The New Horizons spacecraft did just this in 2015 July as it shot past the distant world at a speed of about 80,000 kilometers per hour. Images from this spectacular passage have been color enhanced, vertically scaled, and digitally combined into the featured two-minute time-lapse video. As your journey begins, light dawns on mountains thought to be composed of water ice but colored by frozen nitrogen.  Soon, to your right, you see a flat sea of mostly solid nitrogen that has segmented into strange polygons that are thought to have bubbled up from a comparatively warm interior.  Craters and ice mountains are common sights below. The video dims and ends over terrain dubbed bladed because it shows 500-meter high ridges separated by kilometer-sized gaps.  The robotic New Horizons spacecraft has too much momentum to ever return to Pluto and is now headed out of our Solar System.",
  "media_type": "other",
  "service_version": "v1",
  "title": "Pluto Flyover from New Horizons"
}

After (With this change)

{
  "date": "2025-05-18",
  "explanation": "What if you could fly over Pluto -- what might you see? The New Horizons spacecraft did just this in 2015 July as it shot past the distant world at a speed of about 80,000 kilometers per hour. Images from this spectacular passage have been color enhanced, vertically scaled, and digitally combined into the featured two-minute time-lapse video. As your journey begins, light dawns on mountains thought to be composed of water ice but colored by frozen nitrogen.  Soon, to your right, you see a flat sea of mostly solid nitrogen that has segmented into strange polygons that are thought to have bubbled up from a comparatively warm interior.  Craters and ice mountains are common sights below. The video dims and ends over terrain dubbed bladed because it shows 500-meter high ridges separated by kilometer-sized gaps.  The robotic New Horizons spacecraft has too much momentum to ever return to Pluto and is now headed out of our Solar System.",
  "media_type": "video",
  "service_version": "v1",
  "title": "Pluto Flyover from New Horizons",
  "url": "https://apod.nasa.gov/apod/image/2505/PlutoFlyover_NewHorizons.mp4"
}

Related issues

I believe this issue is described in this issue and this PR will fix it.

Adjust media_type detection to include embedded <video> HTML5 <video>
Copy link

@vegerot vegerot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@jsolly
Copy link
Author

jsolly commented May 20, 2025

@vegerot let's merge it up! I don't have permission to do it.

@vegerot
Copy link

vegerot commented May 20, 2025

@vegerot let's merge it up! I don't have permission to do it.

I don't work here lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants