Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dantalian-pv
VLC-Android
Commits
32f68f75
Commit
32f68f75
authored
3 years ago
by
Pavel Dmitriev
Browse files
Options
Downloads
Patches
Plain Diff
[PATCH] youtube.lua: disable cookies if redirected to consent page
parent
c8c52d52
No related branches found
No related tags found
No related merge requests found
Pipeline
#103238
passed with stage
in 15 minutes and 32 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libvlc/patches/vlc3/0012-youtube.lua-disable-cookies-if-redirected-to-consent.patch
+69
-0
69 additions, 0 deletions
...outube.lua-disable-cookies-if-redirected-to-consent.patch
with
69 additions
and
0 deletions
libvlc/patches/vlc3/0012-youtube.lua-disable-cookies-if-redirected-to-consent.patch
0 → 100644
+
69
−
0
View file @
32f68f75
From f26577f12c20f63bb698255ac03ffd3eaa4700cc Mon Sep 17 00:00:00 2001
Message-Id: <f26577f12c20f63bb698255ac03ffd3eaa4700cc.1622540062.git.dantalian.pv@gmail.com>
From: Pierre Ynard <linkfanel@yahoo.fr>
Date: Sat, 3 Apr 2021 12:02:34 +0200
Subject: [PATCH] youtube.lua: disable cookies if redirected to consent page
In the past few days, YouTube has started redirecting requests for video
pages to a cookie consent and preference prompt, on a whole separate
page and domain; which prevents playback. We are not interested in
YouTube cookies, nor in consenting to them on behalf of our users, so
this just retries with cookies disabled. YouTube gets the hint and
simply redirects back to the original video page.
Fixes #25616
(cherry picked from commit f21c063ea3b8050541e5c8f4430378dfec85f4a5)
Signed-off-by: Pierre Ynard <linkfanel@yahoo.fr>
---
share/lua/playlist/youtube.lua | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/share/lua/playlist/youtube.lua b/share/lua/playlist/youtube.lua
index f8a8937387..65c81514d1 100644
--- a/share/lua/playlist/youtube.lua
+++ b/share/lua/playlist/youtube.lua
@@ -303,8 +303,8 @@
end
-- Probe function.
function probe()
- return ( ( vlc.access == "http" or vlc.access == "https" )
- and (
+ return ( ( vlc.access == "http" or vlc.access == "https" ) and (
+ ((
string.match( vlc.path, "^www%.youtube%.com/" )
or string.match( vlc.path, "^music%.youtube%.com/" )
or string.match( vlc.path, "^gaming%.youtube%.com/" ) -- out of use
@@ -315,14 +315,27 @@
function probe()
or string.match( vlc.path, "/get_video_info%?" ) -- info API
or string.match( vlc.path, "/v/" ) -- video in swf player
or string.match( vlc.path, "/embed/" ) -- embedded player iframe
- ) )
+ )) or
+ string.match( vlc.path, "^consent%.youtube%.com/" )
+ ) )
end
-- Parse function.
function parse()
- if not string.match( vlc.path, "^www%.youtube%.com/" ) then
+ if string.match( vlc.path, "^consent%.youtube%.com/" ) then
+ -- Cookie consent redirection
+ -- Location: https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXXXXXXXXXXX&gl=FR&m=0&pc=yt&uxe=23983172&hl=fr&src=1
+ -- Set-Cookie: CONSENT=PENDING+355; expires=Fri, 01-Jan-2038 00:00:00 GMT; path=/; domain=.youtube.com
+ local url = get_url_param( vlc.path, "continue" )
+ if not url then
+ vlc.msg.err( "Couldn't handle YouTube cookie consent redirection, please check for updates to this script or try disabling HTTP cookie forwarding" )
+ return { }
+ end
+ return { { path = vlc.strings.decode_uri( url ), options = { ":no-http-forward-cookies" } } }
+ elseif not string.match( vlc.path, "^www%.youtube%.com/" ) then
-- Skin subdomain
return { { path = vlc.access.."://"..string.gsub( vlc.path, "^([^/]*)/", "www.youtube.com/" ) } }
+
elseif string.match( vlc.path, "/watch%?" )
or string.match( vlc.path, "/live$" )
or string.match( vlc.path, "/live%?" )
--
2.26.2
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment