Ewig
V2EX  ›  问与答

在请求爬虫的时候 cookie 传入的方式不同 返回的数据不一样

  •  
  •   Ewig · Dec 7, 2018 · 1421 views
    This topic created in 2738 days ago, the information mentioned may be changed or developed.

    我在请求一些网站的时候 ,cookie 以 str 方式 放入 cookie 里面 还有一种是 header 和 cookie 分开参数传递的 比如这种 headers=headers,cookie=cookie

    还有一种是就是把 cookie 直接写到 header 里面

    4 replies    2018-12-08 11:01:01 +08:00
    luosuosile
        1
    luosuosile  
       Dec 7, 2018
    因为有时候 cookie 会关闭吧
    luoleng
        2
    luoleng  
       Dec 7, 2018
    scrapy 的 setting 里面有个 COOKIES_ENABLED 的参数
    Ewig
        3
    Ewig  
    OP
       Dec 8, 2018
    @luoleng 我设置为 true 了没用的
    Ewig
        4
    Ewig  
    OP
       Dec 8, 2018
    @luosuosile 我设置 COOKIES_ENABLED=true
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1010 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 23:25 · PVG 07:25 · LAX 16:25 · JFK 19:25
    ♥ Do have faith in what you're doing.