模拟登陆某在线教育平台

import requests
from lxml import etree
# http://www.dajiangtai.com/login/check.do
post_url='http://www.dajiangtai.com/login/check.do'
mysession=requests.Session()
login_data={'browser':'%E8%B0%B7%E6%AD%8CChrome%2F77.0.3865.90',
'system':'Win7',
'email':'13053972852',
'password':'python123',
'autoLogin':'on'}
r=mysession.post(post_url,login_data)
myurl='http://www.dajiangtai.com/user/course.do'
res=mysession.get(myurl)
root=etree.HTML(res.text)
my=root.xpath('//ul[@class="fontsize0 my-course-list"][@id="mylearn"]//p[@class="my-course-title"]/text()')
print(my)

posted @ 2019-10-01 20:48  天天见和  阅读(104)  评论(0编辑  收藏  举报