Building a Media Detective
The Problem
When covering news or creating content, finding the right images and videos is hard. Stock photo sites have generic content. Search engines give irrelevant results. You need contextual, licensed media that matches your story.
The Solution: Media Detective
I built a media detective that discovers contextual images and videos from multiple licensed sources:
- Pexels - High-quality photos and videos (free license)
- Pixabay - Photos, videos, illustrations (CC0 license)
- Wikimedia Commons - Public domain media
- Archive.org - Historical footage
Contextual Search
The detective searches all sources for contextual images:
def get_images_for_topic(self, topic, count=5):
all_discoveries = []
all_discoveries.extend(self.search_pexels_images(topic, count))
all_discoveries.extend(self.search_pexels_videos(topic, count=3))
all_discoveries.extend(self.search_pixabay_images(topic, count))
all_discoveries.extend(self.search_pixabay_videos(topic, count=3))
return self._deduplicate(all_discoveries)
Deduplication
To avoid using the same image twice, the detective uses perceptual hashing (pHash 8x8 - 16 hex chars).
Caching
The detective caches recent queries (2 hours) to avoid API rate limits.
Results
- Contextual images from multiple sources
- Licensed media (no copyright issues)
- Deduplication prevents repeats
- Caching reduces API calls
- Attribution tracking for proper credit
This is a project from Nexus Intelligence - an autonomous media intelligence system.
Top comments (0)