使用puppeteer设置cookies登录快手,但是显示没有登录

thomas-yan
  • 1
新手上路,请多包涵

使用cookies.js保存cookies

module.exports = [
  {
    domain: ".kuaishou.com",
    expirationDate: 3758630251,
    hostOnly: false,
    httpOnly: true,
    name: "access_token",
    path: "/",
    sameSite: "unspecified",
    secure: true,
    session: false,
    storeId: "0",
    value:
      "ChFvYXV0aC5hY2Nlc3NUb2tlbhIw3pHvcU41E2Tw3f4SXyQYCKbOUxKYhboHBlbI0IENK6xR8WDqKYy9SauDzdQPXHQqGhLiICkHPKJFr7JGeErh7m5jzagiIFXsTdrzFcJbjaeJuX4ljrUEsmAjF3IQ7ZHs8NqaYhC_KAUwAQ",
    id: 1,
  },

(只节选一段cookies)

在main.js导入cookies

const cookies = require("./cookies");

在page中用setCookie方法载入cookies

await page.setCookie(...cookies);

但是最后登录快手显示未登录

const PROFILE_URL = `https://video.kuaishou.com/profile/${myArgs[0]}}`;
await page.goto(PROFILE_URL, { waitUntil: "networkidle2", timeout: 0 });

想了许多方法未解决

回复
阅读 1.5k
2 个回答

快手的cookie做http only了吗?
也可以直接进入登录页面,用 puppeteer 登陆下试试?

YoneyY
  • 2
新手上路,请多包涵

请问解决了吗

宣传栏