人人自动@所有好友,人人好友,[Python]代码#
人人自动@所有好友,人人好友,[Python]代码#
[Python]代码
# encoding=utf-8import urllib, urllib2, cookielib, re, timecookie = {"t": "此处填写Session字段的t属性"}cookie = "".join(x + "=" + cookie[x] + ";" for x in cookie)opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.CookieJar()))urllib2.install_opener(opener)req = urllib2.Request("http://friend.renren.com/myfriendlistx.do#item_0")req.add_header('Cookie', cookie)content = urllib2.urlopen(req).read()with open("page.html", "w") as f: f.write(content)myid = "此处填写你的id"Token = re.findall('get_check:\'[\d-]*\'?',content)[0].split(':')[1].strip('\'')rtk = re.findall('get_check_x:\'.*?\'',content)[0].split(':')[1].strip('\'')line = re.findall('var friends.*?;',content)[0]print Tokenprint rtkID = []NAME = []i = 0while i<len(line): if line[i:i+2]=='id': ID.append(line[i+4:i+13]) if line[i:i+4]=='name': j = i+7 string = "" while line[j]!='"': string = string+line[j] j = j+1 NAME.append(string) i = i+1print len(ID)#此处status内容可以随意改,也可以改成一条status里@多个好友,大家自己看着改吧i = 0while i<len(ID): status = '@'+NAME[i].decode('unicode_escape')+'('+ID[i]+')'+' ' status = status.encode('utf-8') params = {'content':status,'hostid':myid,'channel':'renren','requestToken':Token,'_rtk':rtk} req = urllib2.Request("http://shell.renren.com/"+myid+"/status", urllib.urlencode(params) ) req.add_header('Cookie', cookie) content = urllib2.urlopen(req).read() time.sleep(3) i = i+1 print i
相关内容
- boost regex 获取 FTP 响应响应消息,boostregex,boost regex获
- Python爬取红黑联盟读书频道的图书,python读书频道,2.
- Learn Python By Practice — Utilities模块,pythonutilities,Utilit
- Google Python Class练习解答1-string1.py,python1-string1.py,stri
- Learn Python By Practice — 排序和元组,pythonpractice,排序和
- 用urllib按照百度音乐分类下载mp3,urllib百度音乐mp3,[P
- 从1到10的循环方式改进,10循环方式改进,换一种循环方
- python的一些好的非主流语法用法,python非主流语法,#编
- Learn Python By Practice — Range和Slice扩展学习,pythonslice,
- HTMLParser笔记,,[Python]代码#-
评论关闭