import requests
url = "http://www.renren.com/972521253/newsfeed/origin"
headers = {
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
"Cookie":"anonymid=jznua4q4txksah; depovince=GW; _r01_=1; jebe_key=ca518537-7bda-493b-b86b-ad401a996af7%7C8dc248aac016c3795e6feff905b2f80f%7C1571566136916%7C1%7C1571566139806; jebe_key=ca518537-7bda-493b-b86b-ad401a996af7%7C8dc248aac016c3795e6feff905b2f80f%7C1571566136916%7C1%7C1571566139807; JSESSIONID=abcV1aX-yv0Ex42MpBS3w; jebecookies=63138269-bc64-429d-a3ed-9bd4354be8b3|||||; ick_login=e623cf31-15a7-4c10-8ed6-d4a63ce6dfca; _de=5DE0D22EEC3A18EE62C07BAAD5B8A6276DEBB8C2103DE356; p=48e937a346a518a29559da523f90d1083; first_login_flag=1; ln_uact=2781162818@qq.com; ln_hurl=http://head.xiaonei.com/photos/0/0/men_main.gif; t=067afd55a9222de84a41e378250d521c3; societyguester=067afd55a9222de84a41e378250d521c3; id=972521253; xnsid=13906ef5; ver=7.0; loginfrom=null; wp_fold=0"
}
response = requests.get(url,headers=headers)
content = response.content.decode('utf8')
#用写的方式,编码方式utf8
with open("renren.html",'w',encoding='utf8') as f:
f.write(content)
爬虫基础——网络请求
最新推荐文章于 2024-09-09 00:00:00 发布