From 2df09371565f50c72dd65cdc9584ada1128b3a01 Mon Sep 17 00:00:00 2001 From: trizen Date: Sun, 30 Jul 2023 17:23:19 +0300 Subject: [PATCH] Fixed the "CONSENT" cookies. Improves upon the previous commit. --- lib/WWW/PipeViewer.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/WWW/PipeViewer.pm b/lib/WWW/PipeViewer.pm index e47277f..436dd04 100644 --- a/lib/WWW/PipeViewer.pm +++ b/lib/WWW/PipeViewer.pm @@ -370,9 +370,23 @@ sub set_lwp_useragent { my $cookies = HTTP::Cookies->new(); - # Consent cookie - $cookies->set_cookie(0, "CONSENT", "YES-m.20230726-14-p0.en+FX+096", - "/", ".youtube.com", undef, 0, 1, '21' . join('', map { int(rand(10)) } 1 .. 8), + # Consent cookies + $cookies->set_cookie(0, "CONSENT", "PENDING+233", "/", ".youtube.com", undef, 0, 1, + "17" . join('', map { int(rand(10)) } 1 .. 8), + 0, {}); + + $cookies->set_cookie(0, "PREF", "tz=UTC", "/", ".youtube.com", undef, 0, 1, + "17" . join('', map { int(rand(10)) } 1 .. 8), + 0, {}); + + # TODO: make the token random + $cookies->set_cookie(0, "SOCS", "CAESEwgDEgk1NTE1MDQ0NTkaAmVuIAEaBgiA0JamBg", + "/", ".youtube.com", undef, 0, 1, "17" . join('', map { int(rand(10)) } 1 .. 8), + 0, {}); + + # TODO: make the token random + $cookies->set_cookie(0, "__Secure-YEC", "CgtCWUtqdVpZQXJUNCiL3pmmBg%3D%3D", + "/", ".youtube.com", undef, 0, 1, "17" . join('', map { int(rand(10)) } 1 .. 8), 0, {}); $agent->cookie_jar($cookies);