- 1、本文档共8页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
09.获取好友列表(9 get a buddy list)
Author: tengge #
#QQ:930372551
# this section, we will learn to get the friends list, by the way of learning Sid extraction
# code some long, this is because the friend from a web page source code in the QQ number and the nickname of more trouble. This code also completes the login, access to Sid, access to online friends list three tasks! If you dont understand the dictionary and regular expressions, look at the previous tenggePy tutorial... Later, I will optimize and optimize... :)
# this section of the code or the 3GQQ login code change, in front of the well!
#6120c test successful
Import httplib
Import urllib
Import re
# regular expression module
Def get_source (myurl, con={): }:
get_source by tengge.
Params = urllib.urlencode (CON)
Headers = {Content-type:application/x-www-form-urlencoded,Accept:text/plain}
Conn = httplib.HTTPConnection (72, 80)
Conn.request (POST, myurl, params, headers)
Data=conn.getresponse (),.Read (),.Replace (amp, ).Replace ( \n ,
# this change, will not use the character to remove, easy to handle
Conn.close ()
Return data
Print please enter your QQ number and press enter.Decode (utf8)
Qq=raw_input ()
Print please enter your password and press enter.Decode (utf8)
Pwd=raw_input ()
# gets a 3GQQ login page source code
Data1=get_source (/s, aid=nLogin3gqqauto=1s_it=1g_f=286sid=gRx6/ZLbzPLJOMkXUX4bTA==)
Mark=postfield name=, Sid, value= .
Start=data1.find (mark)
End=data1.find (/, start+1)
Sid2=data1[start+len (mark): end]
This is # to submit URLs and data
Myurl= /handleLogin, r
Con={Sid: sid2, QQ: str (QQ), PWD: PWD, toQQchat: true, modifySKey: 0, loginType: 1}
# access login data
Data2=get_source (myurl, con)
##### in front of several times #####
This time we only # will print out a successful login failure message, note that each utf8 encoding the Chinese characters accounted for three bytes
Start=data2.find (login)
Print data2[start:start+12].decode (utf8)
# we find out the
您可能关注的文档
- 心肾不交中医辨证施治.doc
- 形容学习精神成语.doc
- 宿舍友情 宿舍里.doc
- 徐宝璜新闻思想和.doc
- 心理学在中国发展和其现状.doc
- 寻找生活中快乐 教案和反思.doc
- 循阅读程序,善抓关键词句 ——谈现代文阅读(必考)思路把握.doc
- 延缓混凝土凝结时间而对后期强度无明显影响外加剂.doc
- 岩石分类与成因.doc
- 岩石分类与鉴定.doc
- 商业综合体外部空间景观设计研究——以合肥市卫星社区大市场为例.pdf
- 上海直播粳稻一次性侧深施肥专用肥开发及应用.pdf
- 基于计算机视觉的苹果叶病害识别方法研究.pdf
- 社会工作者的情感劳动分析--以老年社会工作实务为例.pdf
- 基于脑电与眼动的多模态情感识别研究.pdf
- 数字技术在高师多声部视唱训练中的应用研究.pdf
- 基于铜、镍催化剂对莫西沙星中间体催化加氢性能研究.pdf
- 埇桥地区2021-2023年猪瘟、猪伪狂犬病和猪繁殖与呼吸综合征的流行病学调查分析.pdf
- 稀土金属改性MOFs_TiO2异质结的构建及光催化CO2还原性能.pdf
- 基于问题链的英语阅读教学对高中生思辨能力的影响研究.pdf
文档评论(0)