Skip to content

Fix: Update YouTube transcript fetching to use stable API - #6

Merged
labib2002 merged 1 commit into
mainfrom
fix/youtube-api-errors
Sep 30, 2025
Merged

Fix: Update YouTube transcript fetching to use stable API#6
labib2002 merged 1 commit into
mainfrom
fix/youtube-api-errors

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

This change addresses a critical bug that prevented the extension from fetching YouTube transcripts due to breaking changes in the youtubei.js library. 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 missing offscreen.html file has been added to ensure proper clipboard functionality.


PR created automatically by Jules for task 11653219466095439799

…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.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

@labib2002
labib2002 marked this pull request as ready for review September 30, 2025 19:59
@labib2002
labib2002 merged commit 7e2a174 into main Sep 30, 2025
@labib2002
labib2002 deleted the fix/youtube-api-errors branch September 30, 2025 22:00
labib2002 added a commit that referenced this pull request Jul 10, 2026
Fix: Update YouTube transcript fetching to use stable API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant