Merged
Conversation
Delete 7 exploration scripts and 1 oversized fixture from scripts/yt-probe/. These were used to discover YouTube's watch page data structures during development of fetchExtended(), but all useful logic is now in youtube.ts with proper test coverage. Keep yt-bench.ts (perf benchmarking) and yt-test-tracks.json (fixture), moved up to scripts/. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove id, slug, created_at, updated_at, and source fields — only media_id and track metadata are needed for benchmarking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove extractMusicCard/extractDescHeader unit tests that just assert against mocked JSON structures (circular — won't catch YouTube changes). Replace with integration tests that hit live YouTube across 3 video types: official music, Topic channel, and non-music video. Also unexport extractMusicCard/extractDescHeader since they're internal implementation details. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both functions had identical panel traversal loops. Combine into one extractWatchPageData() that walks the panels once and picks up both music card and description header data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- YouTubeResult: basic fields from oEmbed (fast ~100ms) - YouTubeExtendedResult: adds music metadata from watch page (slow ~900ms) - Clarifies which fields come from which fetch method Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Make author optional in YouTubeResult - youtube.search() now returns YouTubeResult[] instead of SearchResult[] - Search results include payload (videoRenderer object) - Remove redundant SearchResult type - Update specs to reflect changes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add fetchExtended to providers section - Note performance: ~100ms for basic fetch vs ~1s for extended - Clarify extended includes music card data (song, artist, album) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Delete WatchPageData interface - Internal functions return inferred types - Public API (YouTubeExtendedResult) unchanged - Less type duplication, cleaner code Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP.
Two changes:
The fetch method we have from YouTube includes title and duration e.g. the essentials, but it doesn't include the real song used in the video. This adds a new youtube.fetchExtended(url) function that scrapes the YouTube video page for this info. Same approach yt-dlp uses at the moment. It works, we then know the real song most of the time, but downside is that it's around 800ms vs 80ms for this request. This is why I split it into two methods, and it's not run by default via getMedia().
Also deleted the
SearchResultinterface, and madeauthor?optional in YouTubeResult. This wayyoutube.search()now returns YouTubeResult[] with payload: videoRenderer.