存档

文章标签 ‘discuz x2.5自动发帖插件’

discuz x2.5自动登录 签到 发帖 回帖程序python程序

2013年3月12日 3 条评论

程序片段一

# -*- coding: utf-8 -*-
#! /usr/bin/env python
# -*- coding: utf-8 -*-
''' DiscuzRobot - Discuz!论坛的机器人程序,实现了登录,签到,发贴及回帖等功能
by Conanca
'''
import urllib2, urllib, cookielib, re, time
class Robot:
    def __init__(self, forumUrl, userName, password, proxy = None):
        ''' 初始化论坛url、用户名、密码和代理服务器 '''
        self.forumUrl = forumUrl
        self.userName = userName
        self.password = password
        self.formhash = ''
        self.isLogon = False
        self.isSign = False
        self.xq = ''
        self.jar = cookielib.CookieJar()
        if not proxy:
            openner = urllib2.build_opener(
	    urllib2.HTTPCookieProcessor(self.jar))
        else:
            openner = urllib2.build_opener(
	    urllib2.HTTPCookieProcessor(self.jar), 
	    urllib2.ProxyHandler({'http' : proxy}))
        urllib2.install_opener(openner)

阅读全文…