DEV Community

Abdulqodir Miraliyev
Abdulqodir Miraliyev

Posted on

I built a Chrome extension that drag-and-drops YouTube videos into playlists using AI

The problem

I have hundreds of saved YouTube videos scattered across playlists. Every time I find something worth saving, I have to: open the video, click "Save", scroll through a list of playlists, find the right one, click it. Repeat dozens of times a day.

I wanted something faster — ideally just drag and drop.

What I built

I built Tortma — a Chrome extension that puts a floating overlay on youtube.com. You drag any video thumbnail onto it, and the AI suggests which of your existing playlists it belongs to. You confirm with one click.

The whole thing takes under 2 seconds per video.

How it works technically

1. Drag-and-drop detection
Content script listens for dragstart on video thumbnails. When a drop event hits the overlay, it extracts the video title and channel name from the DOM.

2. YouTube Data API v3
The extension uses Google OAuth to fetch the user's actual playlists. This means AI suggestions are personalized — it knows your real playlist names and descriptions.

3. AI matching
The video metadata + playlist list gets sent to a backend endpoint. An LLM does semantic matching and returns the best playlist match with a confidence score.

4. Manifest V3
Built on MV3 for future Chrome compatibility. Service worker handles auth token refresh.

The tricky parts

  • OAuth flow in MV3 — The chrome.identity API behaves differently than in MV2. Had to handle token refresh carefully in the service worker.
  • Drag events on YouTube — YouTube's own drag handlers conflict. Had to use capture: true on event listeners and call stopPropagation.
  • AI accuracy — First version just used the playlist name. Adding the playlist description and recent video history improved match accuracy significantly.

Stack

  • Chrome Extension (MV3) — content script, service worker, popup
  • YouTube Data API v3
  • Google OAuth 2.0
  • Backend API for AI matching

Try it

It's live on the Chrome Web Store: https://chromewebstore.google.com/detail/fmjfpejhfgkehebmcjakjkkdhchdmpce

Free tier: 20 videos/day. Would love feedback on the UX or any edge cases you hit!

Top comments (1)

Collapse
 
frank_signorini profile image
Frank

How did you handle the YouTube API rate limits for the AI-driven playlist additions? I'm following your work for more insights on this, would love to discuss potential optimization techniques.