参考:Python爬虫:browsercookie库获取浏览器cookie
# 获取浏览器cookie
import browsercookie
import requests
from bs4 import BeautifulSoup
import pandas as pd
# 消除 warning InsecureRequestWarning
from requests.packages import urllib3
urllib3.disable_warnings()
# 获取cookie,前提是需要浏览器登陆过
chrome_cookie = browsercookie.chrome()
在请求的时候
加上cookies=chrome_cookie,即可