Research: block video ads in DPG apps #2

Closed
opened 2026-10-09 20:59:30 +02:00 by midas · 3 comments
Owner

Goal

Find out how to block video ads (pre-roll/mid-roll) in DPG apps (de Volkskrant now; De Gelderlander and other DPG titles later) without breaking video playback, and write it up so a patch can be implemented. If the research is conclusive, implement it as a patch (extend Hide ads or add Hide video ads).

What we know (from docs/apps/volkskrant.md, 7.52.0)

  • The current Hide ads patch only covers banner/native slots: AdvertisementLoadingHandler.load returns null, so every AdvertisementContainer is Hidden.
  • Not covered: video pre-roll via Google IMA, wrapped by DPG in be.persgroep.advertising.video.ima (unobfuscated).
  • Ad SDKs present: Google Mobile Ads/Ad Manager, Xandr/AppNexus (com.appnexus.opensdk, can also do outstream video), Prebid (org.prebid), Google IMA, MRAID.
  • The ad SDKs are still initialised at startup (application/startup/task/AdvertisementStartupTask).

Research questions

  • Which video player does the app use (Media3/ExoPlayer with the IMA extension, a DPG player, JW Player, Bitmovin, ...)? Where is it created?
  • Where do video ads appear: article videos, the video section, live streams, podcasts/audio (nl.dpgmedia.mcdpg.amalia.*; check for audio pre-rolls too)?
  • How is the ad request built? Look for the VAST/VMAP ad tag URL (strings such as pubads.g.doubleclick.net, adTagUrl, ImaSdkFactory, AdsLoader, AdsRequest, AdDisplayContainer) and the DPG classes in be.persgroep.advertising.video.ima that pass it on.
  • Is there a single choke point comparable to AdvertisementLoadingHandler.load? Candidates, in order of preference:
    1. The DPG layer that decides whether a video gets ads or supplies the ad tag (return "no ads" / null / empty tag).
    2. The place where the IMA AdsLoader is attached to the player (skip attaching it).
    3. Last resort: IMA SDK internals (fragile, avoid).
  • Does the player handle "no ad tag" gracefully, i.e. does the content start immediately instead of hanging on a spinner or showing an error? This is the main risk.
  • Is the ad decision also driven by remote config or a per-video flag, and is there a cleaner switch there?
  • Is the structure identical in De Gelderlander (shared DPG platform)? Fingerprint so it works for all DPG apps.
  • Optional: can AdvertisementStartupTask be skipped safely so the ad SDKs are never initialised? Only if risk-free; not required.

Method

  1. .\scripts\decompile.ps1 on the current Volkskrant APK. Delegate the broad search through decompiled/ to an Explore/Sonnet subagent (see CLAUDE.md) and read the few relevant files yourself.
  2. On the device (with the user's OK), find an article with a video that shows a pre-roll in the unpatched app; adb logcat filtered on IMA / ExoPlayer / persgroep helps confirm the flow.
  3. Fingerprint on unobfuscated DPG class/SDK names and strings, never on obfuscated names (see AGENTS.md).

Deliverables

  • A "Video ads" section in docs/apps/volkskrant.md (or the shared DPG doc): call chain, chosen hook, why, and what the injected smali does.
  • If feasible, the patch, meeting the definition of done in AGENTS.md: build, Applied: ... on the real APK, and a device test showing that a video starts directly without pre-roll and plays to the end, plus a regression check that banner ads stay hidden.
  • Decide: extend Hide ads (users get it automatically) or add a separate Hide video ads patch (can be toggled off). Separate is safer if playback can break.
  • Commit as feat: ... (pre-release on dev; ask before pushing).

Out of scope

Paywall/subscription circumvention, including paid video content.

## Goal Find out how to block **video ads** (pre-roll/mid-roll) in DPG apps (de Volkskrant now; De Gelderlander and other DPG titles later) without breaking video playback, and write it up so a patch can be implemented. If the research is conclusive, implement it as a patch (extend **Hide ads** or add **Hide video ads**). ## What we know (from `docs/apps/volkskrant.md`, 7.52.0) - The current **Hide ads** patch only covers banner/native slots: `AdvertisementLoadingHandler.load` returns `null`, so every `AdvertisementContainer` is `Hidden`. - Not covered: video pre-roll via Google IMA, wrapped by DPG in `be.persgroep.advertising.video.ima` (unobfuscated). - Ad SDKs present: Google Mobile Ads/Ad Manager, Xandr/AppNexus (`com.appnexus.opensdk`, can also do outstream video), Prebid (`org.prebid`), Google IMA, MRAID. - The ad SDKs are still initialised at startup (`application/startup/task/AdvertisementStartupTask`). ## Research questions - [ ] Which video player does the app use (Media3/ExoPlayer with the IMA extension, a DPG player, JW Player, Bitmovin, ...)? Where is it created? - [ ] Where do video ads appear: article videos, the video section, live streams, podcasts/audio (`nl.dpgmedia.mcdpg.amalia.*`; check for audio pre-rolls too)? - [ ] How is the ad request built? Look for the VAST/VMAP ad tag URL (strings such as `pubads.g.doubleclick.net`, `adTagUrl`, `ImaSdkFactory`, `AdsLoader`, `AdsRequest`, `AdDisplayContainer`) and the DPG classes in `be.persgroep.advertising.video.ima` that pass it on. - [ ] Is there a single choke point comparable to `AdvertisementLoadingHandler.load`? Candidates, in order of preference: 1. The DPG layer that decides whether a video gets ads or supplies the ad tag (return "no ads" / null / empty tag). 2. The place where the IMA `AdsLoader` is attached to the player (skip attaching it). 3. Last resort: IMA SDK internals (fragile, avoid). - [ ] Does the player handle "no ad tag" gracefully, i.e. does the content start immediately instead of hanging on a spinner or showing an error? This is the main risk. - [ ] Is the ad decision also driven by remote config or a per-video flag, and is there a cleaner switch there? - [ ] Is the structure identical in De Gelderlander (shared DPG platform)? Fingerprint so it works for all DPG apps. - [ ] Optional: can `AdvertisementStartupTask` be skipped safely so the ad SDKs are never initialised? Only if risk-free; not required. ## Method 1. `.\scripts\decompile.ps1` on the current Volkskrant APK. Delegate the broad search through `decompiled/` to an Explore/Sonnet subagent (see CLAUDE.md) and read the few relevant files yourself. 2. On the device (with the user's OK), find an article with a video that shows a pre-roll in the unpatched app; `adb logcat` filtered on `IMA` / `ExoPlayer` / `persgroep` helps confirm the flow. 3. Fingerprint on unobfuscated DPG class/SDK names and strings, never on obfuscated names (see AGENTS.md). ## Deliverables - [ ] A "Video ads" section in `docs/apps/volkskrant.md` (or the shared DPG doc): call chain, chosen hook, why, and what the injected smali does. - [ ] If feasible, the patch, meeting the definition of done in AGENTS.md: build, `Applied: ...` on the real APK, and a device test showing that a video starts directly without pre-roll and plays to the end, plus a regression check that banner ads stay hidden. - [ ] Decide: extend **Hide ads** (users get it automatically) or add a separate **Hide video ads** patch (can be toggled off). Separate is safer if playback can break. - [ ] Commit as `feat: ...` (pre-release on `dev`; ask before pushing). ## Out of scope Paywall/subscription circumvention, including paid video content.
Author
Owner

Video ads research: De Gelderlander (Kubus platform)

Unlike de Volkskrant (
l.persgroep.edition.*\ using \e.persgroep.advertising.video.ima), De Gelderlander and the regional titles are built on DPG's modern video platform:
l.dpgmedia.publishingservices.videosdk.

Architecture & Choke Points

  • Player: AndroidX Media3 ExoPlayer wrapped in \DefaultPlayer, with Google IMA integrated via Media3's IMA extension (\AdsLoaderProvider).
  • Primary hook: \VideoProduction.getAdsEnabled()Z\
    • Class:
      l.dpgmedia.publishingservices.videosdk.internal.player.data.model.VideoProduction\ (unobfuscated).
    • When returning \ alse\ (\const/4 p0, 0x0; return p0), \PlayerIntentResolver.maybeGetAdTagUrl\ immediately returns
      ull\ without sending an ad tag HTTP request to DPG's servers (\AdRepository.getVideoAdTagUrl).
  • Secondary hook: \VideoPlayableContent.Video.getAdTagUrl()Ljava/lang/String;\
    • Class:
      l.dpgmedia.publishingservices.videosdk.internal.player.core.model.VideoPlayableContent\ (unobfuscated).
    • When returning
      ull\ (\const/4 p0, 0x0; return-object p0), \PlayerPlayableExtKt.getAdsConfiguration\ returns
      ull.
    • Media3's \DefaultMediaSourceFactory\ checks \if (adsConfiguration == null)\ and plays the raw content stream directly without wrapping in an \AdsMediaSource\ (\ed).

Status

  • Documented in \docs/apps/gelderlander.md.
  • Implemented in \Hide ads\ patch for De Gelderlander (\VideoProductionGetAdsEnabledFingerprint\ + \VideoPlayableContentGetAdTagUrlFingerprint).
  • Verified on device (De Gelderlander 9.21.1): videos start playing immediately without pre-roll ads, no playback errors or spinner hangs, and banner/feed ads remain hidden.
### Video ads research: De Gelderlander (Kubus platform) Unlike de Volkskrant (\ l.persgroep.edition.*\ using \e.persgroep.advertising.video.ima\), De Gelderlander and the regional titles are built on DPG's modern video platform: \ l.dpgmedia.publishingservices.videosdk\. #### Architecture & Choke Points - **Player:** AndroidX Media3 ExoPlayer wrapped in \DefaultPlayer\, with Google IMA integrated via Media3's IMA extension (\AdsLoaderProvider\). - **Primary hook:** \VideoProduction.getAdsEnabled()Z\ - Class: \ l.dpgmedia.publishingservices.videosdk.internal.player.data.model.VideoProduction\ (unobfuscated). - When returning \ alse\ (\const/4 p0, 0x0; return p0\), \PlayerIntentResolver.maybeGetAdTagUrl\ immediately returns \ ull\ without sending an ad tag HTTP request to DPG's servers (\AdRepository.getVideoAdTagUrl\). - **Secondary hook:** \VideoPlayableContent.Video.getAdTagUrl()Ljava/lang/String;\ - Class: \ l.dpgmedia.publishingservices.videosdk.internal.player.core.model.VideoPlayableContent\\ (unobfuscated). - When returning \ ull\ (\const/4 p0, 0x0; return-object p0\), \PlayerPlayableExtKt.getAdsConfiguration\ returns \ ull\. - Media3's \DefaultMediaSourceFactory\ checks \if (adsConfiguration == null)\ and plays the raw content stream directly without wrapping in an \AdsMediaSource\ (\ed\). #### Status - Documented in \docs/apps/gelderlander.md\. - Implemented in \Hide ads\ patch for De Gelderlander (\VideoProductionGetAdsEnabledFingerprint\ + \VideoPlayableContentGetAdTagUrlFingerprint\). - Verified on device (De Gelderlander 9.21.1): videos start playing immediately without pre-roll ads, no playback errors or spinner hangs, and banner/feed ads remain hidden.
Author
Owner

De Gelderlander is done (Kubus video SDK, see above). De Volkskrant runs on the Edition platform with be.persgroep.advertising.video.ima, so it needs its own research and hook: tracked in #12. This issue depends on #12 and can be closed once that lands.

De Gelderlander is done (Kubus video SDK, see above). De Volkskrant runs on the Edition platform with `be.persgroep.advertising.video.ima`, so it needs its own research and hook: tracked in #12. This issue depends on #12 and can be closed once that lands.
Author
Owner

Done for both apps: De Gelderlander (9.21.1, device-verified) and de Volkskrant (#12, same DPG video SDK, shared dpg/videosdk patch). Released in v1.4.0.

Done for both apps: De Gelderlander (9.21.1, device-verified) and de Volkskrant (#12, same DPG video SDK, shared `dpg/videosdk` patch). Released in v1.4.0.
midas closed this issue 2026-10-10 10:46:28 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
midas/midas-patches#2
No description provided.