YouTube Enrich
The youtube-enrich plugin searches YouTube for each track in your library and records its view count. View counts are surfaced as a YT Views column in the track table, giving you a complementary popularity signal alongside Spotify’s play count.
Plugin version: 0.1.1 | Stage: Enrich | Requires browser: Yes | Credentials required: None
What It Does
For each track, the plugin:
- Opens a headless browser and navigates to youtube.com.
- Searches for the track using the query
artist title— e.g.Fred Again Delilah. - Scans the search results page for a video whose title and metadata match the track.
- Reads the view count from the result entry (e.g.
2.4K views,10M views) and converts it to an integer (2400, 10000000). - Stores the count as the custom
view_countfield, shown as the YT Views column.
No login or YouTube account is required. The browser navigates YouTube as an anonymous visitor.
Configuration
This plugin has no settings. There are no credentials to enter. Simply install it from Settings → Plugins and run it.
What Gets Enriched
| Column | Description | Example value |
|---|---|---|
| YT Views | Total YouTube view count for the matched video | 10,400,000 |
View counts are parsed from the abbreviated format shown in search results (2.4K, 10M, 1.2B) and stored as exact integers. The displayed value in the track table is formatted with thousands separators for readability.
Note: YouTube links are not yet stored in the track’s links map in v0.1.1. This feature is planned for a future release.
Enrichment Statuses
| Status | Meaning |
|---|---|
| done | A matching video was found and the view count was recorded |
| not_found | No matching video found in search results |
| error | Browser or network error prevented the search |
How Matching Works
The plugin evaluates the top results from a YouTube search for artist title. It looks for a video whose title contains both the artist name and track title. The first result that matches is used — subsequent results are not considered.
View count text is parsed with multiplier expansion:
1.2K→12004.8M→48000001.1B→1100000000- Exact numbers (e.g.
45,231 views) are parsed directly.
Limitations
Because YouTube search is not music-specific, there are a few cases where the match may be incorrect:
- Remixes and edits. A search for
Artist Original Mixmay return a fan-made video of the same track, or a different remix entirely, depending on what YouTube serves first. - Common track titles. Tracks with generic names (e.g.
Lost,Fire) are more likely to match an unrelated video. - Live recordings. For well-known artists, the highest-ranking result is sometimes a live recording rather than the studio version, resulting in a lower-than-expected view count.
- Official vs. unofficial uploads. The view count reflects the specific video found, not the aggregate of all uploads of that track.
For most tracks in an electronic music library, the first result is reliable. For classical, ambient, or non-English language releases, accuracy may be lower.
Tips
- Combine with Spotify Enrich for a fuller popularity picture. YouTube views and Spotify plays measure different audiences and behaviours. A track can have enormous YouTube views from a viral video but relatively modest Spotify streams, or vice versa.
- Sort by YT Views to discover what’s resonating. After enrichment, sort the track table by the YT Views column to quickly rank tracks by their YouTube footprint — useful when choosing between multiple records of a similar feel.
- Re-run periodically. View counts grow over time.
- No rate limiting worries. Because the plugin uses YouTube’s public search page as an anonymous visitor, there are no API keys or quotas to manage. The browser paces requests naturally.