Skip to content

feat(sources): add YouTube search connector (yt-dlp) - #177

Open
matthewdonsemail-lab wants to merge 6 commits into
obris-dev:mainfrom
matthewdonsemail-lab:feat/youtube-search-connector
Open

feat(sources): add YouTube search connector (yt-dlp)#177
matthewdonsemail-lab wants to merge 6 commits into
obris-dev:mainfrom
matthewdonsemail-lab:feat/youtube-search-connector

Conversation

@matthewdonsemail-lab

Copy link
Copy Markdown

Summary

Adds YouTube search capability to OpenMagpie using yt-dlp library, following the same patterns as the Twitter connector.

What's Changed

New Files

  • apps/core/sources/connectors/youtube/__init__.py
  • apps/core/sources/connectors/youtube/client.py (YtDlpClient wrapper)
  • apps/core/sources/connectors/youtube/connector.py (YouTubeSearchConnector)
  • apps/core/sources/connectors/youtube/errors.py (YouTubeError taxonomy)
  • apps/core/sources/connectors/youtube/payloads.py (NewVideoPayload)

Modified Files

  • packages/openmagpie-schema/src/openmagpie_schema/configs.py - Added YouTubeSearchSourceSpec
  • apps/core/pyproject.toml - Added yt-dlp>=2026.07.04 dependency
  • apps/core/sources/connectors/__init__.py - Exported YouTubeSearchConnector

Design Decisions

  1. Search API: Uses yt-dlp's ytsearch<N>:<query> URI scheme - no authentication required for public content
  2. Error Handling: 6 error codes with retry semantics (video_unavailable, rate_limited, js_runtime_missing, network_error, date_parse_error, yt_dlp_error)
  3. Payload Mapping: YouTube metadata -> SourcePayload with title, description, metrics (views/likes/comments), thumbnails, duration
  4. Watermark Filtering: Same dedup pattern as Twitter connector using last_event_at

Testing

Live search verified:

Found 2 videos for "AI news" query
- Zuckerberg makes 'STUNNING' announcement on AI race... (Fox News Clips, 69742 views)
- The AI Safety Tests Are Broken. All Of Them... (AI Revolution, 26092 views)

Full specification in: RESEARCH/YT_DLP_OPENMAGPIE_INTEGRATION.md

This PR stacks on top of PR #175 (X/Twitter connector). Merge that first.

Inference Ops added 3 commits August 13, 2026 14:24
- Import YouTubeSearchConnector
- Add to _REGISTRY dict with kind: youtube_search

The connector code was merged but the registry entry was missing.
This fixes the 'unknown source kind' error when polling YouTube feeds.
Adds YouTube search capability to OpenMagpie using yt-dlp library.

New files:
- apps/core/sources/connectors/youtube/__init__.py
- apps/core/sources/connectors/youtube/client.py (YtDlpClient)
- apps/core/sources/connectors/youtube/connector.py (YouTubeSearchConnector)
- apps/core/sources/connectors/youtube/errors.py (YouTubeError taxonomy)
- apps/core/sources/connectors/youtube/payloads.py (NewVideoPayload)
- RESEARCH/YT_DLP_OPENMAGPIE_INTEGRATION.md

Modified:
- packages/openmagpie-schema/src/openmagpie_schema/configs.py
  - Added YouTubeSearchSourceSpec
  - Added to _BuiltinSourceSpec union
- apps/core/pyproject.toml
  - Added yt-dlp>=2026.07.04 dependency
- apps/core/sources/connectors/__init__.py
  - Exported YouTubeSearchConnector

Features:
- Public YouTube search via ytsearch<N>:<query> URI scheme
- No authentication required for public content
- Error taxonomy with retry semantics
- Watermark-based deduplication
- Metrics extraction (views, likes, comments)
- Thumbnail media attachment
- Duration tracking

Design follows existing Twitter connector patterns for consistency.

Signed-off-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
Co-authored-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
Signed-off-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
Co-authored-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
@matthewdonsemail-lab
matthewdonsemail-lab force-pushed the feat/youtube-search-connector branch from 6781b33 to 44838c5 Compare August 13, 2026 07:26
Inference Ops added 3 commits August 13, 2026 14:31
Signed-off-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
Co-authored-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
Signed-off-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
Co-authored-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
Signed-off-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
Co-authored-by: Inference Ops <7b4bd76efa854d8ae6847735c3c888594039cab6a498c249f289d78a1c0e65ca@inferencesaver.communities.buzz.xyz>
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.

1 participant