使用python在校内发人人网状态(人人网看状态)

时间:2021-05-22

复制代码 代码如下:
#_*_coding:utf_8_

from sgmllib import SGMLParser
import sys, urllib2, urllib, cookielib
import datetime, time

class spider(SGMLParser):

def __init__(self, email, password):
SGMLParser.__init__(self)

self.email = email
self.password = password
self.domain = 'renren.com'

try:
cookie = cookielib.CookieJar()
# a class to handle HTTP cookies
cookieProc = urllib2.HTTPCookieProcessor(cookie)
except:
raise
else:
opener = urllib2.build_opener(cookieProc)
urllib2.install_opener(opener)

def login(self):
print '开始登录'
url = 'http://', 'qishibo123')
renrenspider.login()
#content = raw_input('请输入状态的内容:')
contents =["祝","各","位","同","学","盆","友","在","新","的","一","年","里","身","体","健","康","万","事","如","意","不小心刷屏了,望大家谅解"]
#renrenspider.publish(content)
#content = "新年快乐"
#renrenspider.publish(content)
#renrenspider.publish(content.decode('gb2312').encode('utf-8'))

for content in contents:
renrenspider.publish(content)

用这个程序就可以发状态刷屏了,只不过校内的状态不支持具体时间,看不出效果来,不然每隔两秒一条状态应该会让人惊讶的

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章