-
-
Save muzizongheng/6019506 to your computer and use it in GitHub Desktop.
#Use this utility to access CSDN blog. | |
#Author: jiangong li | |
#Email: [email protected] | |
import base64 | |
from http import cookiejar | |
import urllib.request, urllib.parse, urllib.error | |
#url for accessing | |
csdnLoginUrl = r"http://passport.csdn.net/ajax/accounthandler.ashx?" | |
moduleUrl = r"http://write.blog.csdn.net/postedit/" | |
csdnAccessModuleUrl = r"http://passport.csdn.net/account/loginbox?callback=logined&hidethird=1&from="+urllib.parse.quote(moduleUrl)#http%3a%2f%2fwrite.blog.csdn.net%2f" | |
#install cookie | |
cj = cookiejar.CookieJar(); | |
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)); | |
urllib.request.install_opener(opener) | |
#build request for accessed url | |
homeReq = urllib.request.Request( | |
url = csdnAccessModuleUrl | |
) | |
homeReq.add_header('Accept', 'text/html, application/xhtml+xml, */*'); | |
homeReq.add_header('Accept-Language', 'en-US') | |
homeReq.add_header('Accept-Encoding', 'gzip, deflate') | |
homeReq.add_header('Connection', 'Keep-Alive'); | |
homeReq.add_header('Referer', 'http://passport.csdn.net/account/login?from='+urllib.parse.quote(moduleUrl))#http%3a%2f%2fwrite.blog.csdn.net%2f') | |
homeReq.add_header('User-Agent', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)'); | |
#open access url | |
resp = urllib.request.urlopen(homeReq) | |
print(resp.info()) | |
print(resp.status) | |
print(cj) | |
################################################################################ | |
#build request for login url | |
#post data | |
postdata = { | |
'u':'yourUserName', | |
'p':'yourPassword', | |
'remember':'1', | |
't':'log', | |
'f':urllib.parse.quote(moduleUrl), | |
} | |
postdata = urllib.parse.urlencode(postdata).encode('utf-8') | |
print(postdata) | |
req = urllib.request.Request( | |
url = csdnLoginUrl, | |
data = postdata) | |
req.add_header('Accept', 'text/html, application/xhtml+xml, */*'); | |
req.add_header('Accept-Language', 'en-US') | |
req.add_header('Accept-Encoding', 'gzip, deflate') | |
req.add_header('Connection', 'Keep-Alive'); | |
req.add_header('Referer', csdnAccessModuleUrl) | |
req.add_header('User-Agent', 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)'); | |
#open login url | |
r = urllib.request.urlopen(req) | |
print(r.status) | |
print(r.reason) | |
print(r.geturl()) | |
print(r.info()) | |
data = r.read().decode('utf-8') | |
print(data) | |
print(cj) |
Tried in 2k24 and doesn't work.
- Just go to Quackr.io FRANCE Section (make sure to make an account cuz France numbers require it). Don't try other countries as they will fail or the message won't ever come in.
- Then go to CSDN Login and in the third tab put a phone number that you got from Quackr.io and send a verification code.
Voilà
You are now registered.
Please leave a like and a follow to make my day better :)
Bro, you're a legend! Thanks a lot :)
I've tried using the China phone number, but didn't receive any messages.
I always get an error when csdn makes the POST to https://passport.csdn.net/v1/register/pc/sendVerifyCode to send the sms :/ (HTTP Code 521). Do you guys use a VPN or something like that? @kiraio-moe @MyHouseIsBig
I always get an error when csdn makes the POST to https://passport.csdn.net/v1/register/pc/sendVerifyCode to send the sms :/ (HTTP Code 521). Do you guys use a VPN or something like that? @kiraio-moe @MyHouseIsBig
Did you use the France number?
Well, I always use VPN. So, I don't know if that's the cause.
Yes!, I picked a random france number from quackr but the message is never received. Futher debugging I realize that the request that sends the message returns a 521 status code.
The VPN you use, is using China?. Its a guess that the location might be the problem, or maybe the website is trully down 😅 @kiraio-moe
Yes!, I picked a random france number from quackr but the message is never received. Futher debugging I realize that the request that sends the message returns a 521 status code.
Try different France number then. Someone might have been using the same phone number or likely it has been blocked by CSDN itself.
The VPN you use, is using China?. Its a guess that the location might be the problem, or maybe the website is trully down 😅 @kiraio-moe
I can't truly remember what server I use when I signed up at that time. I used USA, Singapore, France, UK.
Tried in 2k24 and doesn't work.
Just go to Quackr.io FRANCE Section (make sure to make an account cuz France numbers require it). Don't try other countries as they will fail or the message won't ever come in.
Then go to CSDN Login and in the third tab put a phone number that you got from Quackr.io and send a verification code.
You are now registered.
Please leave a like and a follow to make my day better :)