Skip to content

Use curl User-Agent to avoid GDPR consent redirects#647

Open
Hugo1380 wants to merge 5 commits intojoostlek:mainfrom
Hugo1380:fix-is-short
Open

Use curl User-Agent to avoid GDPR consent redirects#647
Hugo1380 wants to merge 5 commits intojoostlek:mainfrom
Hugo1380:fix-is-short

Conversation

@Hugo1380
Copy link

Proposed Changes

The is_short() method now uses a curl User-Agent and disables redirects on the HEAD request.
This prevents YouTube from redirecting EU-based clients to the GDPR consent page, which was causing all videos to be incorrectly detected as non-Shorts.

Related Issues

home-assistant/core#165630

@joostlek joostlek changed the title fix(is_short): use curl User-Agent to avoid GDPR consent redirects Use curl User-Agent to avoid GDPR consent redirects Mar 16, 2026
@joostlek joostlek added the bugfix Inconsistencies or issues which will cause a problem for users or implementers. label Mar 16, 2026
@joostlek
Copy link
Owner

You might need to modify tests

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.86%. Comparing base (bc5ace3) to head (f7599ec).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #647      +/-   ##
==========================================
- Coverage   98.81%   97.86%   -0.95%     
==========================================
  Files           6        6              
  Lines         422      422              
  Branches       52       52              
==========================================
- Hits          417      413       -4     
- Misses          3        7       +4     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Hugo1380
Copy link
Author

Should we modify the tests?

@joostlek
Copy link
Owner

I think so yes, make sure we call with the right header

@Hugo1380
Copy link
Author

I added test

Copy link
Owner

@joostlek joostlek left a comment

Choose a reason for hiding this comment

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

The CI is failing, can you take a look?

@Hugo1380
Copy link
Author

Sorry, it should be better now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Inconsistencies or issues which will cause a problem for users or implementers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants