Last active
December 21, 2015 05:49
-
-
Save zippera/6259794 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding=utf-8 | |
import requests as rq | |
from bs4 import BeautifulSoup as bs | |
lgurl = 'http://mlook.mobi/member/login' | |
host = 'http://mlook.mobi' | |
tmpurl = 'http://mlook.mobi/book/info/6248' | |
hds = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36', | |
'Referer':'http://mlook.mobi/member/login', | |
} | |
s = rq.Session() | |
login_page = s.get(lgurl).content | |
soup = bs(login_page) | |
formhash = soup.find_all('input', {'type': 'hidden', 'name': 'formhash'})[0]['value'] | |
pstdata = { | |
'formhash':formhash, | |
'person[login]':'76398711@qq.com', | |
'person[password]':'123456', | |
} | |
r = s.post(url = lgurl,data = pstdata, headers = hds) | |
with open('r.html','w') as f: | |
f.write(r.content) | |
rr = s.get(tmpurl, headers = hds) | |
with open('rr.html','w') as f: | |
f.write(rr.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment