-
-
Save ZoomQuiet/57990 to your computer and use it in GitHub Desktop.
自动化发布以及 牛妞的起名脚本
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) |
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
# -*- coding: UTF-8 -*- | |
# 姓氏的笔画数 | |
# 需要注意的是康熙字典为准。例如“艹”在康熙字典中通“艸”部,为六画, | |
# 所以所有“艹”部的字部首就算六画,因此“薛”在这里要算十九画。 | |
# “周”从“口”部,在康熙字典影印版 http://www.kangxizidian.com/index2.php 第 181 页 | |
# 共八画 | |
SURNAME_STROKE_NUM = 8 | |
# 名字用字最多允许多少画 | |
MAX_STROKE_NUM = 30 | |
def get_wu_ge(n1, n2, s1): | |
""" | |
获得姓名五格,详情请参考:http://www.hkluck.com/kn/b05-02.php | |
@type n1: int | |
@param n1: 名字第一个字的笔画数 | |
@type n2: int | |
@param n2: 名字第二个字的笔画数 | |
@type s1: int | |
@param s1: 姓氏第一个字的笔画数 | |
@rtype: int, int, int, int, int | |
@return: 姓名五格数值 | |
""" | |
tian_ge = s1+1 | |
ren_ge = s1+n1 | |
di_ge = n1 + n2 | |
wai_ge = s1 + n1 + n2 + 1 - ren_ge | |
zong_ge = s1 + n1 + n2 | |
return tian_ge, ren_ge, di_ge, wai_ge, zong_ge | |
def get_wu_xing(n): | |
""" | |
获得某个格的五行,详情请参考:http://www.hkluck.com/kn/b05-02.php | |
@type n: int | |
@param n: 某个格的数值 | |
@rtype: str | |
@return: 对应的五行 | |
""" | |
wuxing = ['shui', 'mu', 'mu', 'huo', 'huo', 'tu', 'tu', 'jin', 'jin', 'shui'] | |
return wuxing[n % 10] | |
def get_san_cai(tian, ren, di): | |
""" | |
获得三才组合,详情请参考:http://www.hkluck.com/kn/b05-02.php | |
@type tian: int | |
@param tian: 天格的数值 | |
@type ren: int | |
@param ren: 人格的数值 | |
@type di: int | |
@param di: 地格的数值 | |
@rtype: str, str, str | |
@return: 对应的三才 | |
""" | |
return get_wu_xing(tian), get_wu_xing(ren), get_wu_xing(di) | |
# “吉"以上的五格数值 | |
GOOD_WUGEs = set([1, 3, 5, 6, 7, 11, 13, 15, 16, 21, 23, 24, 29, 31, 32, 33, 35, 37, 41, 45, 47, 48, 52, 57, 61, 63, 65, 67, 68, 81]) | |
# “吉”以上的三才组合,偷懒只列出以“水”开始的部分,因为天格决定了这里只需要水开始的三才 | |
GOOD_SANCAIs = [('shui', 'mu', 'mu'),('shui','mu','tu'),('shui','jin','tu')] | |
def find(): | |
""" | |
根据姓名五格三才学说找出适宜的笔画数组合。 | |
只适用于单姓,名字为两个字的情况。 | |
""" | |
for n1 in range(1,MAX_STROKE_NUM): | |
for n2 in range(1,MAX_STROKE_NUM): | |
a,b,c,d,e = get_wu_ge(n1, n2, SURNAME_STROKE_NUM) | |
if set([b,c,d,e]).issubset(GOOD_WUGEs): | |
sc = get_san_cai(a,b,c) | |
if sc in GOOD_SANCAIs: | |
print n1, n2, ' - Wu GE:', a, b, c, d, e, ' - San Cai:', sc | |
if __name__ == "__main__": | |
find() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment