Exemple #1
0
    def putContent(self, n):
        from sailing.core import RowTask

        task = RowTask("test.csv", "ww.csv")
        writer = task._get_done_writer()
        writer.write("%s\n" % n)
        self.logger.info("try:%s" % n)
Exemple #2
0
    def __call__(self, client, api, url='', **kw):

        self.client = client
        self.driver = client.driver
        driver = self.driver
        self.taobao_name = kw['name']
        self.taobao_passwd = kw['passwd']

        self._login_user()

        from sailing.core import RowTask
        task = RowTask("link.txt")
        open_link = task.task_list()

        import re
        for data in open_link:
            # sid = re.search('sid=(\d+)', data).group(1)
            #data = "http://guang.taobao.com/detail/index.htm?sid=%s" % sid
            try:
                self.logger.info("click:%s" % data)
                client.driver.get(data)
                time.sleep(1)
                self.click_like()
            except Exception, e:
                self.logger.exception(
                    "!!!!!!!Failed to click like !!!!!!!!:%s" % e)
Exemple #3
0
    def __call__(self, client, api, url='', **kw):
      
        self.client = client
        self.driver = client.driver
        self.api = api
         
        self.alimama_name = '*****@*****.**'
        self.alimama_passwd = 'jinsiyan118JSY'
        self.login_type = 'alimama'
        
        self.taobao_name = 'x'
        self.taobao_passwd = 'x'
        
        self.apply_plan_url = 'http://pub.alimama.com/index.htm?spm=0.0.0.0.a2DtbH#!/promo/self/items?q=%s&toPage=%s'
        self.currentApplyTimes = 0;
        
        self.last_iframe_postion = None
        
        self.apply_content = '你好,冒泡网淘客申请加入计划;冒泡网【http://shop.emop.cn】由淘客平台转型 CPC(按点击付费)模式,超低点击单价0.3,平台两万微博主继续为您提供优质精准 的流量点击,欢迎咨询加入,联系QQ675942879;'

        from sailing.core import RowTask  
        task = RowTask("apply_keyword.txt")
        apply_keyword = task.task_list()
            
        for page in range(100):    
            for ak in apply_keyword:
                try:
                    self.logger.info("------start, open apply url to apply keyword: %s, page: %s" % (ak.encode('GBK', 'ignore'), page+1))
                    self.open_apply_page(ak, page+1)
                    self.execute_has_campaign()   
                    self.execute_apply()
                except:
                    self.logger.info("----------------except=>execute apply keyword: %s, page: %s" % (ak, page+1))
Exemple #4
0
 def __call__(self, client, api, url='', **kw):
   
      self.client = client
      self.driver = client.driver
      driver = self.driver
      self.taobao_name = kw['name']        
      self.taobao_passwd = kw['passwd']
      
      self._login_user()
      
      from sailing.core import RowTask  
      task = RowTask("link.txt")
      open_link = task.task_list()
      
      import re
      for data in open_link:
         # sid = re.search('sid=(\d+)', data).group(1)
          #data = "http://guang.taobao.com/detail/index.htm?sid=%s" % sid             
          try:
                  self.logger.info("click:%s" % data)
                  client.driver.get(data)
                  time.sleep(1)
                  self.click_like()
          except Exception, e:
                  self.logger.exception("!!!!!!!Failed to click like !!!!!!!!:%s" % e)
Exemple #5
0
    def putContent(self, n):
        from sailing.core import RowTask

        task = RowTask("test.csv", "ww.csv")
        writer = task._get_done_writer()
        writer.write("%s\n" % n)
        self.logger.info("try:%s" % n)
Exemple #6
0
    def __call__(self, client, api, url='', **kw):
        import thread

        self.client = client
        self.taobao_name = kw['name']
        self.taobao_passwd = kw['passwd']

        self.logger.info("start user name:%s, passwd:%s" %
                         (self.taobao_name, self.taobao_passwd))

        self.start_give_conpon = False
        self._has_more_user = True

        from sailing.core import RowTask
        self.taobao_task = RowTask("taobao_user.csv", "done_taobao.csv")
        if self.taobao_name not in self.taobao_task.done_list:

            thread.start_new(self.give_conpon, ())

            #pass
            self.logger.info("start login taobao, .......")

            driver = client.driver
            self.driver = client.driver

            driver.implicitly_wait(8)
            self._check_login(driver)

            for i in range(10):
                if self.start_give_conpon:
                    break
                self.logger.info("waiting to give conpons...")
                time.sleep(2)

            self.empty_retry = 0
            while self._has_more_user and self.empty_retry < 5:
                try:
                    self._start_to_send_conpons()
                    time.sleep(2)
                except Exception, e:
                    self.logger.error(
                        "!!!!!!!Failed to send conons!!!!!!!!:%s" % e)
Exemple #7
0
    def _start_to_send_conpons(self):
        
        driver = self.driver
        
        driver.switch_to_default_content()
        
        
        url = "http://ecrm.taobao.com/mallcoupon/got_bonus.htm"
        self.logger.info("start to get bonus:%s" % url)

        driver.get(url)
        
        
        iframe = self.client.e("#couponlist")
        
        if iframe is None:
            return
        
        #self.logger.info("!!!!!!ifame str:%s" % json.dumps(iframe.element))
        #self.logger.info("!!!!!!ifame:%s" % iframe.element)
        driver.switch_to_frame(iframe)
        
        conpons  = self.client.es("#J_coupon_list .row")
        
        if len(conpons) == 0:
            self.empty_retry = self.empty_retry + 1
        else:
            self.empty_retry = 0
            
        self.logger.info("Found conpons:%s, in user:%s" % (len(conpons), self.taobao_name))
        
        self._writer = None
        
        from sailing.core import RowTask
        
        task = RowTask("test.csv", "done.csv")
        
        user_names = task.task_list()
        for row in conpons:
            title = row.e(".td-shop a")
            shop_name = title.text
            self.logger.info(u"shop name:%s" % shop_name)
            if not shop_name == u'青沁堂':
                continue
            
            btn = row.e("a.J_transfer") 
            try:
                sendTo = user_names.next()
            except Exception, e:
                self._has_more_user = False
                self.logger.info(u"all user is send.., e:%s" % e)
                return
            
            self.logger.info(u"number:%s, send to:%s" % (btn.attr('couponnumber'), sendTo))
            btn.click()
            
            time.sleep(0.2)
            
            nameInput = self.client.e("form[name=transfer] #username")            
            nameInput.send_keys(sendTo)
            
            submitInput = self.client.e("form[name=transfer] input[type=submit]")            
            submitInput.click()

            time.sleep(0.2)
            title = row.e(".td-status").text
            self.logger.info("current user info:%s" % title)
            if sendTo in title:
                task.done_task(sendTo)
    
                self.logger.info(u"current sent user:%s" % task.done_count)
            elif self._check_user_not_found():
                close = self.client.e(".ks-dialog a.ks-ext-close")
                if close:
                    close.click()
                task.done_task(sendTo)
            elif self._check_max_send():
                self.taobao_task.done_task(self.taobao_name)
                self._stop_to_send(sendTo)
                break
            elif self._check_not_done():
                title = row.e(".td-status").text
                if sendTo in title:
                    task.done_task(sendTo)
                    self.logger.info(u"current sent user:%s" % task.done_count)
                else:
                    #只截屏,不推出操作。可能是网速太慢,还可以重试。
                    self._stop_to_send(sendTo)
                    self._has_more_user = True 
                    break
            else:
                self.logger.info(u"failed to send user")
                self._stop_to_send(sendTo)
                break  
Exemple #8
0
    def _start_to_send_conpons(self):

        driver = self.driver

        driver.switch_to_default_content()

        url = "http://ecrm.taobao.com/mallcoupon/got_bonus.htm"
        self.logger.info("start to get bonus:%s" % url)

        driver.get(url)

        iframe = self.client.e("#couponlist")

        if iframe is None:
            return

        #self.logger.info("!!!!!!ifame str:%s" % json.dumps(iframe.element))
        #self.logger.info("!!!!!!ifame:%s" % iframe.element)
        driver.switch_to_frame(iframe)

        conpons = self.client.es("#J_coupon_list .row")

        if len(conpons) == 0:
            self.empty_retry = self.empty_retry + 1
        else:
            self.empty_retry = 0

        self.logger.info("Found conpons:%s, in user:%s" %
                         (len(conpons), self.taobao_name))

        self._writer = None

        from sailing.core import RowTask

        task = RowTask("test.csv", "done.csv")

        user_names = task.task_list()
        for row in conpons:
            title = row.e(".td-shop a")
            shop_name = title.text
            self.logger.info(u"shop name:%s" % shop_name)
            if not shop_name == u'青沁堂':
                continue

            btn = row.e("a.J_transfer")
            try:
                sendTo = user_names.next()
            except Exception, e:
                self._has_more_user = False
                self.logger.info(u"all user is send.., e:%s" % e)
                return

            self.logger.info(u"number:%s, send to:%s" %
                             (btn.attr('couponnumber'), sendTo))
            btn.click()

            time.sleep(0.2)

            nameInput = self.client.e("form[name=transfer] #username")
            nameInput.send_keys(sendTo)

            submitInput = self.client.e(
                "form[name=transfer] input[type=submit]")
            submitInput.click()

            time.sleep(0.2)
            title = row.e(".td-status").text
            self.logger.info("current user info:%s" % title)
            if sendTo in title:
                task.done_task(sendTo)

                self.logger.info(u"current sent user:%s" % task.done_count)
            elif self._check_user_not_found():
                close = self.client.e(".ks-dialog a.ks-ext-close")
                if close:
                    close.click()
                task.done_task(sendTo)
            elif self._check_max_send():
                self.taobao_task.done_task(self.taobao_name)
                self._stop_to_send(sendTo)
                break
            elif self._check_not_done():
                title = row.e(".td-status").text
                if sendTo in title:
                    task.done_task(sendTo)
                    self.logger.info(u"current sent user:%s" % task.done_count)
                else:
                    #只截屏,不推出操作。可能是网速太慢,还可以重试。
                    self._stop_to_send(sendTo)
                    self._has_more_user = True
                    break
            else:
                self.logger.info(u"failed to send user")
                self._stop_to_send(sendTo)
                break