Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1095736
  • 博文数量: 170
  • 博客积分: 1603
  • 博客等级: 上尉
  • 技术积分: 1897
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-09 15:54
文章分类

全部博文(170)

文章存档

2016年(27)

2015年(21)

2014年(27)

2013年(21)

2012年(7)

2011年(67)

我的朋友

分类: Python/Ruby

2012-01-10 16:15:16

麻痹i5 760论坛看了几天收不到800的,麻痹今天一个人出技嘉p55+760才卖950
3分钟后被人秒了我操!!
老子本来不想在刷论坛脚本里加发飞信的,现在我生气啦 555555

就想收i5 750/760和5850/5870公版....
正则不太会,写得烂,公版非公版那边如果有混一起的就不发短信了。
daemon模块是个python守护进程模块,没有这个模块直接把相关代码注释掉然后自己os.fock()两次就是

最新编辑,feixin那个完蛋了加了验证码不能登录啦feixin改版啦!
只能用下面这种短信平台了!

  1. #! /usr/bin/python
  2. # -*- coding: UTF-8 -*-
  3. import struct,re,sys,time
  4. import urllib,urllib2,cookielib
  5. import threading
  6. import daemon

  7. p = daemon.DaemonContext()
  8. p.open()

  9. def fetion(msg):
  10.     url_login = ''
  11.     url_logout = ''
  12.     url_msg = ''
  13.     user = 'your phone'
  14.     password = 'your feixin pass'
  15.     loginstatus = '4'
  16.     arg_t = ''
  17.     cj = cookielib.LWPCookieJar()
  18.     opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  19.     urllib2.install_opener(opener)
  20.     args = {'pass':password, 'm':user,'loginstatus':loginstatus}
  21.     print 'Logining...'
  22.     req = urllib2.Request(url_login, urllib.urlencode(args))
  23.     jump = opener.open(req)
  24.     page = jump.read();
  25.     url = re.compile(r').findall(page)[0]
  26.     arg_t = re.compile(r't=(\d*)').findall(page)[0]
  27.     if url == '/im/login/login.action':
  28.         print "error"
  29.         return
  30.     sendmsg = urllib2.Request(url_msg, urllib.urlencode({'msg':msg}))
  31.     finish = urllib2.urlopen(sendmsg)

  32.     if finish.geturl == '' :
  33.         print 'Send Failed!'
  34.     else:
  35.         print 'Send Successfully'
  36.     logout = urllib2.Request(url_logout + arg_t)
  37.     response = urllib2.urlopen(logout)
  38.     finish.close()
  39.     jump.close()
  40.     response.close()
  41.     print 'Logout Successfully!'
  42.     #print response.read().decode('utf-8').encode('gbk')


  43. def getUrl(condition,bbs_url,lock,url_list):
  44.     k = 0
  45.     while k == 0:
  46.         print url_list
  47.         try:
  48.             respone = urllib2.urlopen(bbs_url)
  49.             charset = respone.headers.getparam('charset')
  50.             if charset is None:
  51.                 charset = "GBK"
  52.             Html_text = respone.read().decode(charset)
  53.             respone.close()
  54.         except:
  55.             print "error"
  56.         i = 0
  57.         lines = Html_text.split('\n')
  58.         for line in lines:
  59. # print line
  60. # if condition['re_CupAndP55'].search(line) or (condition['re_Video_No'].search(line) and condition['re_Video'].search(line)):
  61.             if condition['re_CupAndP55'].search(line) or ( not condition['re_Video_No'].search(line) and condition['re_Video_Yes'].search(line) and condition['re_Video'].search(line)):
  62. # print "test===== " + line
  63.                 link = re.compile('.*).findall(line)
  64.                 if len(link) == 0:
  65.                     true_link = re.compile('\/.*[0-9]').findall(lines[i-1])
  66.                     if len(true_link)>0:
  67.                         lock.acquire()
  68.                         if '' + true_link[0] + '\n' not in url_list:
  69.                             fetion("!!!!!2nd hand!!!!!!!check %s" % true_link[0])
  70.                             try:
  71.                                 try:
  72.                                     f = open('/root/2hand.txt','a+')
  73.                                     f.writelines('%s\n' % true_link[0])
  74.                                     url_list.append('%s\n' % true_link[0])
  75.                                 finally
  76.                                     f.close()
  77.                             except:
  78.                                 pass
  79.                         lock.release()
  80.                 else:
  81.                     lock.acquire()
  82.                     if link[0] + '\n' not in url_list:
  83.                         fetion("!!!!!2nd hand!!!!!!!check %s" % link[0])
  84.                         try:
  85.                             try:
  86.                                 f = open('/root/2hand.txt','a+')
  87.                                 f.writelines('%s\n' % link[0])
  88.                                 url_list.append('%s\n' % link[0])
  89.                             finally:
  90.                                 f.close()
  91.                         except:
  92.                             pass
  93.                     lock.release()
  94.             i += 1
  95.         time.sleep(60)
  96. # k += 1

  97. class myGet(object):
  98.     def __init__(self,input_list):
  99.         self.lock = threading.Lock()
  100.         self.url_list = input_list
  101.         self.url = {'gz':'','zol':'/subcate_list_300.html','chh':''}
  102.         self.condition = {'re_CupAndP55':re.compile(r'(?=i5 760|i5 750|i5750|i5760i|p7p55d).*/a>',re.I),\
  103.                           're_Video':re.compile('(5850|5870).*/a>',re.I),\
  104.                           're_Video_Yes':re.compile(u'公版',re.I),\
  105.                           're_Video_No':re.compile(u'非公版',re.I)}

  106.     def run(self):
  107.         for i in self.url.values():
  108.             postThread = threading.Thread(target=getUrl,args=(self.condition,i,self.lock,self.url_list))
  109.             postThread.start()

  110. if __name__ == '__main__':
  111.     f = open('/root/2hand.txt','a+')
  112.     input_list = f.readlines()
  113.     f.close()
  114.     get = myGet(input_list)
  115.     get.run()

阅读(1448) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~