快手微博授权登录源码
.版本 2
.支持库 spec
.子程序 微博登录, 逻辑型, 公开
.参数 账号, 文本型
.参数 密码, 文本型
.参数 IP, 文本型
.参数 授权链接, 文本型, 参考
.参数 Err, 文本型, 参考
.局部变量 http, WinInet
.局部变量 Ret, 文本型
.局部变量 json, 类_json
.局部变量 verifyToken, 文本型
.局部变量 uid, 文本型
http.SetProxy (IP)
http.AutoCookies (1)
http.Open (“POST”, “https://passport.weibo.cn/sso/login”)
http.SetUserAgent (“Mozilla/5.0 (Linux; Android ” + 文本_取右边 (帐号信息.安卓版本, “_”) + “; xiaomi 6 Build/LMY49I) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36”)
http.SetReferer (“https://passport.weibo.cn/signin/login?client_id=2459267064&redirect_uri=//www.gifshow.com/i/connect/cbsina&display=sdk&action=login&rf=1&version=0031205000&sso_type=1&offcialMobile=true&scope=email,friendships_groups_read,,statuses_to_me_read,follow_app_official_microblog,invitation_write”)
http.Send (“username=” + 账号 + “&password=” + 密码 + “&savestate=1&r=&ec=0&pagerefer=&entry=mweibo&wentry=&rf=1&loginfrom=2&client_id=2459267064&code=&qq=&mainpageflag=1&hff=&hfp=”)
Ret = http.GetResponseTextUtf8ToAnsi ()
调试输出 (Ret)
json.解析 (Ret)
.判断开始 (json.取通用属性 (“retcode”) = “20000000”)
http.SetRedirect (假)
http.Open (“POST”, “https://open.weibo.cn/oauth2/authorize”)
http.SetUserAgent (“Mozilla/5.0 (Linux; Android ” + 文本_取右边 (帐号信息.安卓版本, “_”) + “; xiaomi 6 Build/LMY49I) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36”)
http.SetReferer (“https://passport.weibo.cn/signin/login?client_id=2459267064&redirect_uri=//www.gifshow.com/i/connect/cbsina&display=sdk&action=login&rf=1&version=0031205000&sso_type=1&offcialMobile=true&scope=email,friendships_groups_read,,statuses_to_me_read,follow_app_official_microblog,invitation_write”)
http.Send (“client_id=2459267064&redirect_uri=http%3A%2F%2Fwww.gifshow.com%2Fi%2Fconnect%2Fcbsina&display=sdk&action=login&rf=1&version=0031205000&sso_type=1&offcialMobile=true&scope=email%2Cfriendships_groups_read%2C%2Cstatuses_to_me_read%2Cfollow_app_official_microblog%2Cinvitation_write&wm=3349&ticket=” + json.取通用属性 (“data.ticket”))
Ret = http.GetResponseTextUtf8ToAnsi ()
verifyToken = 文本_取出中间文本 (Ret, “verifyToken#引号 value=#引号”, #引号)
uid = 文本_取出中间文本 (Ret, “uid#引号 value=#引号”, #引号)
.判断开始 (verifyToken ≠ “”)
http.Open (“POST”, “https://open.weibo.cn/oauth2/authorize”)
http.SetUserAgent (“Mozilla/5.0 (Linux; Android ” + 文本_取右边 (帐号信息.安卓版本, “_”) + “; xiaomi 6 Build/LMY49I) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36”)
http.SetReferer (“https://passport.weibo.cn/signin/login?client_id=2459267064&redirect_uri=//www.gifshow.com/i/connect/cbsina&display=sdk&action=login&rf=1&version=0031205000&sso_type=1&offcialMobile=true&scope=email,friendships_groups_read,,statuses_to_me_read,follow_app_official_microblog,invitation_write”)
http.Send (“display=sdk&action=scope&scope=&withOfficalFlag=0&withOfficalAccount=null&response_type=code®Callback=https%253A%252F%252Fopen.weibo.cn%252F2%252Foauth2%252Fauthorize%253Fclient_id%253D2459267064%2526response_type%253Dcode%2526display%253Dsdk%2526redirect_uri%253Dhttp%25253A%25252F%25252Fwww.gifshow.com%25252Fi%25252Fconnect%25252Fcbsina%2526from%253D%2526with_cookie%253D&redirect_uri=http%3A%2F%2Fwww.gifshow.com%2Fi%2Fconnect%2Fcbsina&client_id=2459267064&appkey62=3XCSMM&state=&from=&offcialMobile=true&uid=” + uid + “&url=&verifyToken=” + verifyToken + “&visible=0&version=0031205000&sso_type=1”)
授权链接 = 文本_取出中间文本 (http.GetAllResponseHeaders (), “Location:”, #换行符)
返回 (真)
.默认
授权链接 = 文本_取出中间文本 (http.GetAllResponseHeaders (), “Location:”, #换行符)
返回 (真)
.判断结束
.默认
Err = json.取通用属性 (“msg”)
返回 (假)
.判断结束