Skip to content

Add referer header for Duck Player #6407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 1, 2025

Conversation

CrisBarreiro
Copy link
Contributor

@CrisBarreiro CrisBarreiro commented Jul 16, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/task/1210811808963690?focus=true

Description

Set referer header to local assets directory in compliance with new TOS

Steps to test this PR

Feature 1

  • Set up Charles Proxy
    • Disable macOS proxy under Charles toolbar > Proxy
    • Enable SSL proxying and include location *:* under Charles toolbar > Proxy > SSL Proxying settings
    • Check IP address under Charles toolbar > Help > Local IP addresses. Check port under Charles toolbar > Proxy settings
  • Set up proxy for WiFi connection on your phone by setting IP address and port from previous step
  • Open the app and load http://charlesproxy.com/getssl
  • Download the certificate and install as CA certificate
  • Load a video on Duck Player
  • Using Charles proxy, check that requests to https://www.youtube-nocookie.com/embed/... have referer header set to http://android.mobile.duckduckgo.com

UI changes

n/a

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CrisBarreiro CrisBarreiro force-pushed the feature/cris/duckplayer/add-referer-header branch from 14e08f2 to c7ee8da Compare July 16, 2025 15:29
@CrisBarreiro CrisBarreiro changed the title Add referer header Add referer header for Duck Player Jul 16, 2025
Copy link
Contributor

@marcosholgado marcosholgado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to test this but was not able to. Couldn't consistently see embeds calls, with Charles they are all encrypted since we don't own the domain and with chrome inspect it only gave me the basic headers.

Would be great to have more detailed testing steps and also change from draft to ready to review once the TODO is done.

@CrisBarreiro CrisBarreiro force-pushed the feature/cris/duckplayer/add-referer-header branch 2 times, most recently from 47ca5de to c2ffb28 Compare July 30, 2025 15:15
@CrisBarreiro CrisBarreiro force-pushed the feature/cris/duckplayer/add-referer-header branch from c2ffb28 to 6222e57 Compare July 30, 2025 15:19
@CrisBarreiro CrisBarreiro marked this pull request as ready for review July 31, 2025 08:44
if (isYoutubeWatchUrl(url)) {
return processYouTubeWatchUri(request, url, webView)
} else if (isSimulatedYoutubeNoCookie(url)) {
return processSimulatedYouTubeNoCookieUri(url, webView)
} else if (duckPlayerFeature.addCustomEmbedReferer().isEnabled() && isYouTubeNoCookieEmbedUri(url, webViewUrl)) {
return try {
WebResourceResponse("text/html", "UTF-8", getEmbedWithReferer(request))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getEmbedWithReferer() can return null, would that be the correct thing to send in the WebResourceResponse?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. When I made it nullable, I was thinking to return a null response (so we continue loading the original request), but that's not what I'm doing here. Thanks for catching it!

Copy link
Contributor

@marcosholgado marcosholgado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CrisBarreiro CrisBarreiro merged commit 8199755 into develop Aug 1, 2025
9 checks passed
@CrisBarreiro CrisBarreiro deleted the feature/cris/duckplayer/add-referer-header branch August 1, 2025 09:06
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy