Python Demo Login Blog Park (attached: questions)

Source: Internet
Author: User

After analysis, blog Park login using jsencrypt encryption, so log in request to use ciphertext, involving the following fields

INPUT1: Ciphertext for user name

INPUT2: Cipher Correspondence cipher

Login Request Link Https://passport.cnblogs.com/user/signin

1 ImportUrllib2 ImportHttp.cookiejar3 ImportJSON4 5Cookie =Http.cookiejar.CookieJar ()6Cookie = Http.cookiejar.MozillaCookieJar ('Cookie.txt')7Handler =urllib.request.HTTPCookieProcessor (Cookie)8Opener =Urllib.request.build_opener (handler)9Jsondata = {Ten     "INPUT1":"xxxxxxxxxxxxxxxxxxxx", One     "Input2":"xxxxxxxxxxxxxxxxxxxx", A     "Remember":"false" - } -PostData = bytes (Json.dumps (jsondata),'UTF8') thePostURL ='Https://passport.cnblogs.com/user/signin' -Heads = { -     "Accept":"Application/json, Text/javascript, */*; q=0.01", -     "accept-encoding":"gzip, deflate", +     "Accept-language":"zh-cn,zh;q=0.8", -     "Connection":"keep-alive", +     "Content-type":"Application/json; Charset=utf-8", A     "Cookies":"um_distinctid=15ada3078c4464-03af923f0903eb-3e64430f-1fa400-15ada3078c5357; pgv_pvi=4363802624; hm_lvt_cec7b3b7ecb170891406ea59237c9168=1491961611; __GADS=ID=9ACAE56062D760D7:T=1493871262:S=ALNI_MBT7TJWBA5WR1BUVOTHVJAZLBZHFG; _ga=", at     "Host":"passport.cnblogs.com", -     "Origin":"https://passport.cnblogs.com", -     "Referer":"Https://passport.cnblogs.com/user/signin?ReturnUrl=https%3A%2F%2Fwww.cnblogs.com%2F", -     "user-agent":"mozilla/5.0 (Windows NT 10.0; WOW64) applewebkit/537.36 (khtml, like Gecko) chrome/50.0.2661.102 safari/537.36", -     "Verificationtoken":"Ibayena2aturpdkb7wvjbr3d0gnpj8tf9bkpdu-tio1fqbfu8o3mtldx_llitm50c8bkgwrum6gjjn4pd_ V19C24H5I1U9F2NRO5WZ7OUTJ0U22K0UDREPHARCLIER1YPL_QC_SX4HWNHJYWIUDTPJNUUJEZ1LXMYVDZRV9PXARSH7MQVIDX1XU1", -     "X-requested-with":"XMLHttpRequest" in } -Request = Urllib.request.Request (PostURL, PostData, headers=heads) to  +Response =Opener.open (Request) - Print(Response.read (). Decode ("UTF8")) the ## persist cookies to a file *Cookie.save (Ignore_discard=true, ignore_expires=True) $ #View the information in the cookiePanax Notoginseng #For item in cookie: - #print (' Name = ' + item.name) the #print (' Value = ' + item.value) + #Login successful to access Administration page AResponse = Opener.open ("https://i.cnblogs.com/") the Print(Response.read (). Decode ("UTF8")) +  - #start to brush comments $Comment = bytes (Json.dumps ({"Blogapp":"WUJF", $                             "PostID": 6475097, -                             "Body":"xxxxxxxxxxxx", -                             "Parentcommentid": 0 the}),'UTF8') - WuyiResponse =Opener.open ( the     "http://www.cnblogs.com/mvc/PostComment/Add.aspx", comment) - #return information {"Id": 0, "issuccess": false, "message": "Invalid postid! "," Data ": null} Wu Print(Response.read (). Decode ("UTF8"))
View Code

The link to submit a comment is http://www.cnblogs.com/mvc/PostComment/Add.aspx

The request JSON is as follows

{"Blogapp": "WUJF",
"PostID": 6475097,
"Body": "Xxxxxxxxxxxx",
"Parentcommentid": 0
}

But I don't know why the blog park will always return

{"Id": 0, "issuccess": false, "Message": "Invalid postid! "," Data ": null}

Another: environmental python3.5

If there are tossing out the brothers, welcome message pointing!

Python Demo Login Blog Park (attached: questions)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.