人人自动@所有好友,人人好友,提取浏览器保存的cook
人人自动@所有好友,人人好友,提取浏览器保存的cook
提取浏览器保存的cookie,绕开验证码
详细请看 http://nkuflk.com/?p=176
# 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#该片段来自于http://byrx.net
相关内容
- python使用点操作符访问字典(dict)数据,pythondict,#from h
- python正则表达式验证字符串是否是MAC地址,python正则表
- python正则表达式验证ipv6地址,pythonipv6,def ipv6_add
- python验证文件是否可读可写,python验证文件可读,# Imp
- python dns解析:将域名转换为ip地址,pythondns,import sock
- 一个简单的python定时器实现,python定时器,下面介绍以
- 增强版的cp,增强版cp,完全兼容系统cp特性支持
- 生成四位不重复数字(0-9)的所有组合,四位0-9,Python语言
- Python ConfigParser模块,pythonconfigparser,在程序中使用配置
- python中os模块的常用方法,pythonos模块,import osos.
评论关闭