Created
December 18, 2008 06:22
-
-
Save qingfeng/37413 to your computer and use it in GitHub Desktop.
sina bar auto post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
from twill import * | |
import urllib2,re | |
USERNAME = 'YOUR USERNAME' | |
PASSWORD = 'YOUR PASSWORD' | |
def login(): | |
return ''' | |
go http://login.sina.com.cn/hd/signin.php?entry=blog | |
showforms | |
fv 1 username %(username)s | |
fv 1 password %(password)s | |
showforms | |
submit 0 | |
''' | |
def autopost(): | |
return ''' | |
go http://bar.sina.com.cn/thread.php?tid=2153216615 | |
fv 3 content "Love You!!" | |
fv 3 link http://xmwww.com/uploadfile/fun/uploadfile/200812/20081215045212514.jpg | |
fv 3 anonymous 0 | |
submit | |
''' | |
def main(): | |
data = {'username':USERNAME,'password':PASSWORD} | |
cmd=login()%data | |
print cmd | |
print execute_string(cmd) | |
print execute_string(autopost()) | |
if __name__ == '__main__': | |
import doctest | |
# doctest.testmod() | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import sys | |
try: | |
from twill import * | |
except ImportError: | |
print "Please install twill module." | |
sys.exit(0) | |
import urllib2,re | |
import random | |
import time | |
USERNAMES = [ | |
'erengu77@sina.com', | |
'forumboss', | |
'shagengning', | |
'五月樱花猫', | |
'n1ght摇摆摆', | |
'就爱到处晃荡', | |
'滇南夕照', | |
] | |
PASSWORD = '' | |
MSGS = [ | |
"爱国者是民族企业,应该支持!", | |
"太厉害了!", | |
"我顶我顶我顶!", | |
"振奋人心阿!", | |
"天天看的到啊.....", | |
"酱油", | |
"华丽的飘过", | |
"我的中国心", | |
"我觉得不错", | |
"支持民族企业!", | |
"爱国者好样的", | |
] | |
def login(): | |
return ''' | |
go http://login.sina.com.cn/hd/signin.php?entry=blog | |
showforms | |
fv 1 username "%(username)s" | |
fv 1 password %(password)s | |
showforms | |
submit 0 | |
''' | |
def autopost(): | |
return ''' | |
go %(url)s | |
showforms | |
fv 4 fms_body "%(msg)s" | |
submit | |
''' | |
def main(url): | |
username = random.sample(USERNAMES,1)[0].decode("utf8").encode("gbk") | |
data = {'username':username,'password':PASSWORD} | |
cmd=login()%data | |
print execute_string(cmd) | |
msg = random.sample(MSGS,1)[0].decode("utf8").encode("gbk") | |
print execute_string(autopost()%{'msg':msg,'url':url}) | |
def cmd_parse(): | |
from optparse import OptionParser | |
parser = OptionParser(usage="usage: %prog [options]",version="%prog 1.0") | |
parser.add_option("-t", dest="looptime",help=u"发帖间隔时间",default=7) | |
parser.add_option("-u", "--url", dest="url",help=u"要刷回复的URL地址", | |
default="http://bbs.tour.sina.com.cn/tableforum/App/view.php?fid=731&bbsid=410&subid=0&tbid=5994&p=goto51689") | |
parser.add_option("-c", help=u"纯刷点击") | |
(options, args) = parser.parse_args() | |
return options | |
if __name__ == '__main__': | |
options=cmd_parse() | |
print options | |
for x in range(100): | |
main(options.url) | |
time.sleep(options.looptime) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment