#Coding=utf-8ImportRequests fromlxmlImportetree fromMultiprocessing.dummyImportPoolcook={"Cookies":"Your Cookies"}url='Http://weibo.cn/u/uid'#html=requests.get (URL). Content#Print HTMLHTML=requests.get (url,cookies=Cook). Content#Html=requests.get (url,cookies=cook). Text#html=bytes (ByteArray (html,encoding= ' utf-8 '))selector=etree. HTML (HTML) content=selector.xpath ('//span[@class = "CTT"]') foreachinchContent:text=each.xpath ('string (.)') b= 1PrintText
Operation Result:
Method One:
Html=requests.get (Url,cookies=cook). Content
Method Two:
Html=requests.get (url,cookies=Cook). texthtml=bytes (ByteArray (html,encoding='utf-8 '))
Geek Course--directional crawler: Simple analog login http://www.jikexueyuan.com/course/995.html
Core content:
Introduction and use of 1.Fiddler
2.Fiddler Crawl Analytics Packets
3. Known Cookies login Sina Weibo
4.Requests Analog Login
Cookie Emulation Login