Skip to content

Add Udemy video lecture segment skipping support#24

Open
devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
devin/1774198897-udemy-segment-skipping
Open

Add Udemy video lecture segment skipping support#24
devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
devin/1774198897-udemy-segment-skipping

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Mar 22, 2026

  • I agree to license my contribution under GPL-3.0 and agree to allow distribution on app stores as outlined in LICENSE-APPSTORE

To test this pull request, follow the instructions in the wiki.


Summary

Adds a dedicated content script for Udemy lecture pages that enables segment skipping (sponsor, selfpromo, interaction, intro, outro, filler, preview) on udemy.com/course/*/learn/lecture/* URLs.

The key design choice is completion-safe skipping: instead of seeking past segments (which would break Udemy's course progress tracking), the extension mutes audio and sets playback to 16x speed so the segment plays through quickly while Udemy still counts it as watched.

Changes

  • src/udemyContent.ts (new, ~741 lines): Standalone content script handling segment fetching, skip scheduling, preview bar overlay, skip notice UI, and popup message handling for Udemy pages
  • src/utils/udemyUtils.ts (new, 141 lines): Udemy platform detection, video ID extraction from URL, and DOM selectors for video player elements
  • manifest/chrome-manifest-extra.json: Added https://*.udemy.com/* host permission and content script entry for Udemy lecture pages
  • manifest/manifest-v2-extra.json: Same for Manifest V2 (Firefox/Safari)
  • webpack/webpack.common.js: Added udemyContent webpack entry point

Updates since last revision

Fixed issues from initial review:

  • Duplicate sendResponse({}) at end of message listener → Removed fallthrough; each case now calls sendResponse explicitly and returns true
  • No event listener cleanup → Added removeVideoListeners() function; called on lecture change and before re-adding listeners to prevent duplicates
  • Missing return true for async message cases → All switch cases now return true to keep the message channel open

⚠️ Items for reviewer attention

  1. 16x playback rate assumption: FAST_FORWARD_RATE = 16 is hardcoded. Browsers may cap video.playbackRate — needs validation that Udemy's player actually accepts this value.

  2. Video ID format vs API compatibility: Generated IDs are udemy-{courseSlug}-{lectureId} — these are much longer than YouTube's 11-char IDs. Verify the hash-prefix API lookup in getSegmentsForVideo() handles these correctly.

  3. CSS selectors are speculative: Udemy uses CSS modules with generated hash suffixes (e.g. --container--YDQRW). The selectors use [class*='...'] patterns which are fragile and have not been tested against the live site.

Human review checklist

  • Confirm getSegmentsForVideo() works with long non-YouTube video IDs (udemy-{slug}-{id})
  • Test video.playbackRate = 16 on Udemy's player in target browsers (Chrome, Firefox)
  • Verify CSS selectors ([class*='video-player'], etc.) match current Udemy DOM structure
  • Check that completion-safe skip (mute + 16x) actually preserves Udemy course progress
  • Verify SPA navigation detection works reliably across lecture transitions

Link to Devin session: https://app.devin.ai/sessions/1aba184a70f04b36a9a2fe0cd79c51c2
Requested by: @erkinalp

- Add udemyContent.ts: Dedicated content script for Udemy with
  completion-safe skip mechanism (mute + 16x speed instead of seeking)
  to preserve Udemy's course progress tracking
- Add udemyUtils.ts: Udemy platform detection, video ID extraction,
  player element selectors
- Update Chrome manifest: Add Udemy host permissions and content script
  injection for udemy.com/course/*/learn/lecture/* pages
- Update V2 manifest: Add Udemy permissions and content script for
  Firefox/Safari compatibility
- Update webpack config: Add udemyContent entry point

Supported categories: sponsor, selfpromo, interaction, intro, outro,
filler, preview, music_offtopic

Features:
- Completion-safe skipping: Mutes audio and speeds up to 16x during
  segments so Udemy still records progress as watched
- SPA navigation detection for Udemy's single-page app
- Preview bar overlay showing segment positions
- Skip notice UI with category indicators
- Manual and auto-skip modes based on user configuration
- Segment creation support from popup

Co-Authored-By: Erkin Alp Güney <erkinalp9035@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

Original prompt from Erkin

The task is to add segment skipping support for Udemy video lectures within the erkinalp/EditTogether repository. This involves integrating Udemy course information into the existing system, specifically for the following categories:

  • Interaction Reminder

  • Intro

  • Outro

  • Filler

  • Preview/Recap

  • Self Promo

  • Ensure that the integration is seamless with the existing codebase.

  • Update relevant UI components to allow users to select and link Udemy lectures within the specified categories.

  • Udemy's course completion logic should still think those portions are thoroughly viewed.

  • Consider how Udemy course data will be stored and retrieved.

  • Submit a pull request with the changes. Ensure all tests pass and the new functionality is thoroughly tested.

You only need to look in the following repo: erkinalp/EditTogether

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 2 commits March 22, 2026 17:08
- Add removeVideoListeners() to properly clean up event listeners on
  lecture change, preventing duplicate handlers
- Remove duplicate sendResponse({}) fallthrough at end of message listener
- Add return true to all message handler cases to keep the message channel
  open for async responses
- Add explicit sendResponse({}) in update case before returning

Co-Authored-By: Erkin Alp Güney <erkinalp9035@gmail.com>
- Return false from early guard clause when not on Udemy
- Return false as default after switch statement for unmatched messages

Co-Authored-By: Erkin Alp Güney <erkinalp9035@gmail.com>
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