Exemplo n.º 1
0
	def monitor(self, bot, l_lock, t_lock):
		self.update()
		while(1):
			while not self.empty():
				paste = self.get()
				self.ref_id = paste.id
				with l_lock:
					helper.log('[*] Checking ' + paste.url)
				paste.text = helper.download(paste.url)
				with l_lock:
					tweet = helper.build_tweet(paste)
				if tweet:
					print tweet
					with t_lock:
						helper.record(tweet)
						bot.PostUpdate(tweet)
			self.update()
			# If no new results... sleep for 5 sec
			while self.empty():
				with l_lock:
					helper.log('[*] No results... sleeping')
				sleep(SLEEP_SLEXY)
				self.update()
Exemplo n.º 2
0
	def monitor(self, bot, l_lock, t_lock):
		self.update()
		while(1):
			while not self.empty():
				paste = self.get()
				self.ref_id = paste.id
				with l_lock:
					helper.log('[*] Checking ' + paste.url)
				# goober pastie - Not actually showing *raw* text.. Still need to parse it out
				paste.text = BeautifulSoup(helper.download(paste.url)).pre.text
				with l_lock:
					tweet = helper.build_tweet(paste)
				if tweet:
					print tweet
					with t_lock:
						helper.record(tweet)
						bot.PostUpdate(tweet)
			self.update()
			# If no new results... sleep for 5 sec
			while self.empty():
				with l_lock:
					helper.log('[*] No results... sleeping')
				sleep(SLEEP_PASTIE)
				self.update()
Exemplo n.º 3
0
 def monitor(self, bot, t_lock):
     self.update()
     while(1):
         while not self.empty():
             paste = self.get()
             self.ref_id = paste.id
             logging.info('[*] Checking ' + paste.url)
             # goober pastie - Not actually showing *raw* text.. Still need
             # to parse it out
             paste.text = self.get_paste_text(paste)
             tweet = helper.build_tweet(paste)
             if tweet:
                 logging.info(tweet)
                 with t_lock:
                     helper.record(tweet)
                     try:
                         bot.statuses.update(status=tweet)
                     except TwitterError:
                         pass
         self.update()
         while self.empty():
             logging.debug('[*] No results... sleeping')
             time.sleep(self.sleep)
             self.update()