A userscript that lets you categorize, filter, sort, and hide videos on your YouTube subscription feed.
- Category filtering — Assign channels to categories (Music, Gaming, Tech, etc.) and filter your feed by category using a chip-style button bar
- Hide categories — Mark categories as hidden so their videos don't appear in the default "All" view
- Sort by date — Reorder your subscription feed by upload recency (parses "X time ago" labels)
- Auto-detect categories — Optionally provide a YouTube Data API v3 key to auto-classify channels based on their topic metadata
- Manual overrides — Full settings UI to assign or reassign any channel to any category
- Persistent storage — All settings, channel assignments, and filter state are saved across sessions
- Import / Export — Back up and restore your configuration as JSON
- SPA-aware — Handles YouTube's single-page-app navigation and infinite scroll
- Dark/light theme — Uses YouTube's CSS custom properties so it matches your current theme
| Browser | Extension |
|---|---|
| Firefox | Tampermonkey or Violentmonkey |
| Chrome | Tampermonkey or Violentmonkey |
Click the link below (or paste the raw URL into your userscript manager's "Install from URL" dialog):
Alternatively, copy the contents of ytsort.user.js and create a new script in your userscript manager.
Navigate to https://www.youtube.com/feed/subscriptions. You should see a new filter bar above your video grid.
The filter bar appears at the top of the subscription feed:
- All — Show all videos (minus any hidden categories)
- Category chips — Click one or more categories to show only those. Click again to deselect.
- Sort by Date — Toggle chronological re-ordering of the visible video cards
- Settings — Open the configuration modal
Open via the gear button on the filter bar, or from the userscript manager menu.
Lists every channel discovered from your feed. Use the dropdown next to each channel to assign it to a category. A search box filters the list.
Add new categories, remove existing ones, or toggle category visibility:
- [hide] — Videos from this category won't appear in the "All" view
- [show] — Restore the category to the "All" view
- × — Delete the category (affected channels revert to "Uncategorized")
Provide a YouTube Data API v3 key to enable automatic category detection:
- Go to the Google Cloud Console
- Create a project (or use an existing one)
- Enable the YouTube Data API v3
- Create an API key credential
- Paste the key into the settings and click Save Key
- Click Auto-Detect Now to classify discovered channels
The auto-detector reads each channel's topicDetails.topicCategories from the YouTube API and maps them to built-in categories. It will not overwrite channels you've already manually categorized.
Quota note: The YouTube Data API has a daily quota of 10,000 units. Each channel resolution costs 1 unit, and each batch of 50 channels for topic detection costs 1 unit. A feed with 200 subscriptions would use roughly 200 + 4 = 204 units.
- Export — Generate a JSON snapshot of your categories and channel assignments
- Import — Paste a previously exported JSON to restore settings
- Reset All — Clear all YTSort data and revert to defaults
- The script runs on all
youtube.compages and listens for YouTube's SPA navigation events (yt-navigate-finish,yt-page-data-updated). - When you visit
/feed/subscriptions, it waits for the grid to render, then injects the filter bar. - It scans each video card for the channel name using multiple DOM selector fallbacks.
- Each channel is looked up in the stored channel-to-category map. New channels default to "Uncategorized".
- A
MutationObserverwatches the grid for new cards loaded via infinite scroll and processes them automatically. - Filtering works by toggling
display: noneon video card elements. - Date sorting parses the relative time strings ("2 hours ago", "3 days ago") into seconds and reorders the DOM.
- Firefox — Tampermonkey, Violentmonkey, Greasemonkey 4+
- Chrome / Edge — Tampermonkey, Violentmonkey
- YouTube's DOM structure changes periodically. The script uses multiple fallback selectors for resilience, but may need updates if YouTube makes major layout changes.
MIT