Anh em cho em hỏi cách lấy cookie google bằng email và password mà không cần dùng giả lập browser với. Em mò mấy ngày rồi mà không ra, đến cả thằng youtube-dl cũng chưa làm được (github[.]com/ytdl-org/youtube-dl/issues/26196). Nhưng có một bác VN làm được mới ghê, đây là output của bác ấy, chỉ dùng GuzzleHttp mà không cần tới giả lập như Selenium, Puppeteer,... Code: O:27:"GuzzleHttp\Cookie\CookieJar":2:{s:36:"GuzzleHttp\Cookie\CookieJarcookies";a:20:{i:0;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:3:"SID";s:5:"Value";s:71:"xxxxxxxxx-xxxxxxxxx.";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:0;s:7:"Discard";b:0;s:8:"HttpOnly";b:0;s:8:"Priority";s:4:"HIGH";}}i:1;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:11:{s:4:"Name";s:14:"__Secure-1PSID";s:5:"Value";s:71:"xxxxxxxxxxxxxxxxxx.";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";s:9:"SameParty";b:1;}}i:2;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:11:{s:4:"Name";s:14:"__Secure-3PSID";s:5:"Value";s:71:"xxxxxxxxxxxxxxxxxx.";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";s:8:"SameSite";s:4:"none";}}i:3;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:4:"LSID";s:5:"Value";s:71:"xxxxxxxxx.";s:6:"Domain";s:19:"accounts.google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";}}i:4;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:11:{s:4:"Name";s:13:"__Host-1PLSID";s:5:"Value";s:71:"xxxxxxxxx.";s:6:"Domain";s:19:"accounts.google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";s:9:"SameParty";b:1;}}i:5;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:11:{s:4:"Name";s:13:"__Host-3PLSID";s:5:"Value";s:71:"xxxxxxxxx.";s:6:"Domain";s:19:"accounts.google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";s:8:"SameSite";s:4:"none";}}i:6;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:4:"HSID";s:5:"Value";s:17:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:0;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";}}i:7;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:4:"SSID";s:5:"Value";s:17:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";}}i:8;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:6:"APISID";s:5:"Value";s:34:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:0;s:7:"Discard";b:0;s:8:"HttpOnly";b:0;s:8:"Priority";s:4:"HIGH";}}i:9;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:7:"SAPISID";s:5:"Value";s:34:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:0;s:8:"Priority";s:4:"HIGH";}}i:10;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:11:{s:4:"Name";s:17:"__Secure-1PAPISID";s:5:"Value";s:34:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:0;s:8:"Priority";s:4:"HIGH";s:9:"SameParty";b:1;}}i:11;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:11:{s:4:"Name";s:17:"__Secure-3PAPISID";s:5:"Value";s:34:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:0;s:8:"Priority";s:4:"HIGH";s:8:"SameSite";s:4:"none";}}i:12;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:15:"ACCOUNT_CHOOSER";s:5:"Value";s:140:"xxxxxxxxx-xxxxxxxxx";s:6:"Domain";s:19:"accounts.google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";}}i:13;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:11:"__Host-GAPS";s:5:"Value";s:113:"1:xxxxxxxxx:xxxxxxxxx";s:6:"Domain";s:19:"accounts.google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1735373340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"Priority";s:4:"HIGH";}}i:15;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:9:{s:4:"Name";s:6:"1P_JAR";s:5:"Value";s:13:"2022-12-29-08";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1674893340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:0;}}i:16;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:3:"AEC";s:5:"Value";s:59:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1687853340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"SameSite";s:3:"lax";}}i:17;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:9:{s:4:"Name";s:3:"NID";s:5:"Value";s:192:"xxxxxxxxx-xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1688112540;s:6:"Secure";b:0;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;}}i:21;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:5:"SIDCC";s:5:"Value";s:74:"xxxxxxxxx-Lj3t3L3oLnnhg";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1703837340;s:6:"Secure";b:0;s:7:"Discard";b:0;s:8:"HttpOnly";b:0;s:8:"priority";s:4:"high";}}i:22;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:10:{s:4:"Name";s:16:"__Secure-1PSIDCC";s:5:"Value";s:72:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1703837340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"priority";s:4:"high";}}i:23;O:27:"GuzzleHttp\Cookie\SetCookie":1:{s:33:"GuzzleHttp\Cookie\SetCookiedata";a:11:{s:4:"Name";s:16:"__Secure-3PSIDCC";s:5:"Value";s:72:"xxxxxxxxx";s:6:"Domain";s:11:".google.com";s:4:"Path";s:1:"/";s:7:"Max-Age";N;s:7:"Expires";i:1703837340;s:6:"Secure";b:1;s:7:"Discard";b:0;s:8:"HttpOnly";b:1;s:8:"priority";s:4:"high";s:8:"SameSite";s:4:"none";}}}s:39:"GuzzleHttp\Cookie\CookieJarstrictMode";b:0;}
Bác cứ nghiên cứu từ từ rồi sẽ ra, nó đơn giản hơn thế nhiều, quan trọng là mình tìm hướng nào đi thôi.
Google sử dụng 1 loại token cho tất cả các sản phẩm của mình, bạn chỉ cần lấy được token đó là có thể sử dụng để request cho hầu hết các sản phẩm, ứng dụng của google. Vậy cái guzzle cookie kia là bạn lấy từ một script nào đó của mình đấy à?
@noenmo đúng rồi bác --- Double Post Merged, Jan 4, 2023, Original Post Date: Jan 4, 2023 --- tks ae, để em mò thêm xem sao