Fix: Update YouTube transcript fetching to use stable API - #6
Conversation
…functionality by adopting the recommended `youtubei.js` API and improving URL parsing. The key changes are: 1. **Replaced `fetchTranscriptWithApi` with a stable implementation**: The function now uses the high-level `info.getTranscript()` helper from `youtubei.js`. This avoids relying on fragile internal API response structures, which were causing the `Cannot read properties of undefined (reading 'caption_tracks')` and subsequent `400 Bad Request` errors. 2. **Improved `getYouTubeVideoId` function**: The URL parsing logic has been updated to correctly extract video IDs from standard (`/watch`), shortened (`youtu.be`), and embed (`/embed/`) URLs, making the extension more robust. 3. **Added missing `offscreen.html`**: A minimal `offscreen.html` file has been created to support the extension's clipboard operations, which was a latent bug. These changes restore the core functionality of the extension and make it more resilient to future API changes.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. |
Fix: Update YouTube transcript fetching to use stable API
This change addresses a critical bug that prevented the extension from fetching YouTube transcripts due to breaking changes in the
youtubei.jslibrary. The fix replaces the faulty implementation with a more robust solution that uses the library's stable, high-level API. Additionally, the video ID parsing has been improved to support more URL formats, and a missingoffscreen.htmlfile has been added to ensure proper clipboard functionality.PR created automatically by Jules for task 11653219466095439799