使用Cookie登录豆瓣

  1. 使用Fiddler抓包工具找到在豆瓣网的cookie。
  2. 把cookie键值对(一个)写在headers
  3. 发起请求
self.headers = {
            "User-Agent": "Mozihttps://accounts.douban.com/j/mobile/login/basiclla/5.0 (Macintosh; Intel Mac OS X 10_14_3) "
                          "AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
            'Host': 'accounts.douban.com',
            'Referer': 'https://accounts.douban.com/passport/login_popup?login_source=anony',
            'Cookie': 'bid=????????;push_doumail_num=0;__utmv=30149280.23335;__gads=ID=33060b07d241d218:T=1635751059:S=ALNI_MYmeJDReRRg5txDWiNOskW5dLzTng;l="108258";push_noty_num=0;__utmz=30149280.1635777007.5.4.utmcsr=accounts.douban.com|utmccn=(referral)|utmcmd=referral|utmcct=/;_pk_ref.100001.2fad=%5B%22%22%2C%22%22%2C1635778892%2C%22https%3A%2F%2Fmovie.douban.com%2Ftyperank%3Ftype_name%3D%25E9%259F%25B3%25E4%25B9%2590%26type%3D14%26interval_id%3D100%3A90%26action%3D%22%5D;_pk_id.100001.2fad=a3eab08e9f757d5f.1635758199.4.1635780830.1635777004.;apiKey=;__utma=30149280.983987116.1635751060.1635777007.1635819461.6;__utmc=30149280;__utmt=1;__utmb=30149280.1.10.1635819461;login_start_time=1635819468918'

        }

  

 

posted @ 2021-11-02 15:24  Mello  阅读(1777)  评论(0编辑  收藏  举报