马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码如下:import requests
headers = {
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36",
'Cookie': 'antipas=04408186y9630m4800m; uuid=6325ceae-74e6-4263-da25-0ee65e8c7e08; cityDomain=cs; clueSourceCode=%2A%2300; user_city_id=204; ganji_uuid=1648696376621876843367; sessionid=18e6ce90-3127-4d8e-ed61-28f7863e1b95; lg=1; cainfo=%7B%22ca_a%22%3A%22-%22%2C%22ca_b%22%3A%22-%22%2C%22ca_s%22%3A%22self%22%2C%22ca_n%22%3A%22self%22%2C%22ca_medium%22%3A%22-%22%2C%22ca_term%22%3A%22-%22%2C%22ca_content%22%3A%22-%22%2C%22ca_campaign%22%3A%22-%22%2C%22ca_kw%22%3A%22-%22%2C%22ca_i%22%3A%22-%22%2C%22scode%22%3A%22-%22%2C%22keyword%22%3A%22-%22%2C%22ca_keywordid%22%3A%22-%22%2C%22display_finance_flag%22%3A%22-%22%2C%22platform%22%3A%221%22%2C%22version%22%3A1%2C%22client_ab%22%3A%22-%22%2C%22guid%22%3A%226325ceae-74e6-4263-da25-0ee65e8c7e08%22%2C%22ca_city%22%3A%22gz%22%2C%22sessionid%22%3A%2218e6ce90-3127-4d8e-ed61-28f7863e1b95%22%7D; preTime=%7B%22last%22%3A1582296921%2C%22this%22%3A1582296885%2C%22pre%22%3A1582296885%7D'
}
url='https://www.guazi.com/cs/buy/o3/#bread'
#模拟浏览器发送请求或许相应
resp=requests.get(url,headers=headers)
resp.encoding = "utf-8"
html=resp.text
print(html)
图片如下:
你要用你自己的 use-agent 和浏览器的 cookie 才行。
我的 cookie 只在我的浏览器里,你复制我的去用,这个网站在你的浏览器中是找不到这个cookie的,只有用你自己的电脑打开那个网站时苏哦保留的 cookie 才行。
|