Beispiel #1
0
// [3]单点登录, 可重复
func (this *WebQQ) ptlogin_login(code string) (urlStr string, err error) {
	res, err := this.getWithReferer(
		_PTLOGIN_URL+"login?"+(url.Values{
			"u":            {this.id_str},
			"p":            {this.genPwd(code)},
			"verifycode":   {code},
			"webqq_type":   {_WEBQQ_TYPE},
			"action":       {_LOGIN_ACTION},
			"js_ver":       {_JS_VER},
			"aid":          {_WEBQQ_APPID},
			"remember_uin": {"1"}, "login2qq": {"1"}, "u1": {"http://web2.qq.com/loginproxy.html?login2qq=1&webqq_type=10"}, "h": {"1"}, "ptredirect": {"0"}, "ptlang": {"2052"}, "daid": {"164"}, "from_ui": {"1"}, "pttype": {"1"}, "dumy": {""}, "fp": {"loginerroralert"}, "mibao_css": {"m_webqq"}, "t": {"1"}, "g": {"1"}, "js_type": {"0"},
			"login_sig": {this.login_sig}}).Encode(), this.sig_url)
	util.Try(err)
	defer res.Body.Close()
	raw := util.MustReadAll(res.Body)
	ss := strings.Split(string(raw), "'")
	// 出错
	if ss[1] != "0" {
		err = fmt.Errorf("[ptlogin_login] fail_login %s:%s", ss[1], ss[9])
		return
	}
	//ptuiCB('0','0','http://ptlogin4.web2.qq.com/check_sig?pttype=1&uin=2735284921&service=login&nodirect=0&ptsig=MPlx81vcwwhHDYZeAsCdaFoQg3nTXyy67sQAYCewxu0_&s_url=http%3a%2f%2fweb2.qq.com%2floginproxy.html%3flogin2qq%3d1%26webqq%5ftype%3d10&f_url=&ptlang=2052&ptredirect=100&aid=1003903&daid=164&j_later=0&low_login_hour=0&regmaster=0','0','登录成功!', '菊菊菊菊菊菊');
	urlStr = ss[5]
	util.DEBUG.Logf("[ptlogin_login] return %s", ss[9])
	return
}
Beispiel #2
0
// [未完成]发帖
func (this *Tieba) postFid(fid, kw, title, content string) (result *Result, err error) {
	this.checkTbs()

	parm := []string{
		this._BDUSS(),
		this._CLIENT_ID(),
		_CLIENT_TYPE,
		_CLIENT_VERSION,
		_PHONE_IMEI,
		"content=" + content,
		"fid=" + fid,
		"kw=" + kw,
		this._TBS(),
		"stErrorNums=0",
		"timestamp=1390753277530",
		"title=" + title,
	}
	str := fmt.Sprint(strings.Join(parm, "&"),
		"&sign=", this.getSign(parm))
	req := bytes.NewBufferString(str)
	res, err := this.post(_THREAD_URL, req, "BDUSS="+this.BDUSS+";")
	bin := util.MustReadAll(res.Body)
	util.DEBUG.Log("[Post]", str, "\n========\n", string(bin))
	result = &Result{}
	err = json.Unmarshal(bin, result)
	return
}
Beispiel #3
0
// 获取贴吧fid
func (this *Tieba) GetFid(kw string) (fid string) {
	res, err := this.client.Get(_FID_URL + kw)
	if err != nil {
		return
	}
	defer res.Body.Close()
	str := string(util.MustReadAll(res.Body))
	rex := regexp.MustCompile(`"fid" +?value="(\d+)"`)
	m := rex.FindStringSubmatch(str)
	if len(m) > 0 {
		fid = m[1]
	}
	return
}
Beispiel #4
0
func (this *Tieba) Sign(kw string) (result *Result, err error) {
	this.checkTbs()
	parm := []string{
		this._BDUSS(),
		"kw=" + kw,
		this._TBS(),
	}
	str := fmt.Sprint(strings.Join(parm, "&"), "&sign=", this.getSign(parm))
	req := bytes.NewBufferString(str)
	res, err := this.post(_SIGN_URL, req, "")
	bin := util.MustReadAll(res.Body)
	util.DEBUG.Log("[Sign]", str, "\n========\n", string(bin))
	result = &Result{}
	err = json.Unmarshal(bin, result)
	return
}
Beispiel #5
0
func (this *Tieba) getLikedOnePage(pn int) (result *LikedResult, err error) {
	parm := []string{
		this._BDUSS(),
		this._CLIENT_ID(),
		_CLIENT_TYPE,
		_CLIENT_VERSION,
		_PHONE_IMEI,
		_NET_TYPE,
		fmt.Sprint("pn=", pn),
	}
	str := fmt.Sprint(strings.Join(parm, "&"), "&sign=", this.getSign(parm))
	req := bytes.NewBufferString(str)
	res, err := this.post(_MYLIKE_URL, req, "")
	bin := util.MustReadAll(res.Body)
	util.DEBUG.Log("[getLikedOnePage]", str, "\n========\n", string(bin))
	result = &LikedResult{}
	err = json.Unmarshal(bin, result)
	return
}
Beispiel #6
0
func (this *Tieba) login(vcode, vcode_md5 string) (result *LoginResult, err error) {
	parm := []string{
		"_client_id=" + this.client_id,
		_CLIENT_TYPE,
		_CLIENT_VERSION,
		_PHONE_IMEI,
		"passwd=" + base64.StdEncoding.EncodeToString([]byte(this.Password)),
		"un=" + url.QueryEscape(this.Username),
		"vcode_md5=" + vcode_md5,
	}
	code := ""
	if vcode != "" {
		code = "&vcode=" + vcode
	}
	str := fmt.Sprint(strings.Join(parm, "&"), code, "&sign=", this.getSign(parm))
	req := bytes.NewBufferString(str)
	res, err := this.post(_LOGIN_URL, req, "")
	bin := util.MustReadAll(res.Body)
	util.DEBUG.Log(str, "\n========\n", string(bin))
	result = &LoginResult{}
	err = json.Unmarshal(bin, result)
	return
}