mirror of
git://git.acid.vegas/booster.git
synced 2024-11-22 07:46:37 +00:00
minor update to prepair for major cleanup
This commit is contained in:
parent
624276b818
commit
d9f8aa3cce
10
README.md
10
README.md
@ -1,8 +1,8 @@
|
||||
###### Requirments
|
||||
* [Tweepy](http://pypi.python.org/pypi/tweepy)
|
||||
## Requirments
|
||||
- [Tweepy](http://pypi.python.org/pypi/tweepy)
|
||||
|
||||
###### Instructions
|
||||
Register a Twitter account, and [sign up](http://dev.twitter.com/apps/new) for a new developer application.
|
||||
## Instructions
|
||||
Create a Twitter account & [sign up](http://dev.twitter.com/apps/new) for a new developer application.
|
||||
|
||||
Go to your new application settings "Keys and Access Tokens" tab.
|
||||
|
||||
@ -16,7 +16,7 @@ Change your access to "Read, Write and Access direct messages".
|
||||
|
||||
Edit your `config.py` and change the Twitter API settings.
|
||||
|
||||
###### Mirrors
|
||||
## Mirrors
|
||||
- [acid.vegas](https://acid.vegas/booster) *(main)*
|
||||
- [SuperNETs](https://git.supernets.org/acidvegas/booster)
|
||||
- [GitHub](https://github.com/acidvegas/booster)
|
||||
|
@ -10,14 +10,13 @@ import time
|
||||
import config
|
||||
|
||||
def action(msg):
|
||||
print('%s | [#] - %s' % (get_time(), msg))
|
||||
print(f'{get_time()} | [#] - {msg}')
|
||||
|
||||
def alert(msg):
|
||||
print('%s | [+] - %s' % (get_time(), msg))
|
||||
print(f'{get_time()} | [+] - {msg}')
|
||||
|
||||
def check_config():
|
||||
for item in (config.consumer_key, config.consumer_secret, config.access_token, config.access_token_secret):
|
||||
if item == 'CHANGEME':
|
||||
if 'CHANGEME' in (config.consumer_key, config.consumer_secret, config.access_token, config.access_token_secret):
|
||||
error_exit('Edit your config file!')
|
||||
|
||||
def check_imports():
|
||||
@ -28,63 +27,41 @@ def check_imports():
|
||||
|
||||
def check_privileges():
|
||||
if check_windows():
|
||||
if ctypes.windll.shell32.IsUserAnAdmin() != 0:
|
||||
return True
|
||||
return True if ctypes.windll.shell32.IsUserAnAdmin() != 0 else return False
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
if os.getuid() == 0 or os.geteuid() == 0:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return True if os.getuid() == 0 or os.geteuid() == 0 else return False
|
||||
|
||||
def check_version(major):
|
||||
if sys.version_info.major == major:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return True if sys.version_info.major == major else return False
|
||||
|
||||
def check_windows():
|
||||
if os.name == 'nt':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return True if os.name == 'nt' else return False
|
||||
|
||||
def clear():
|
||||
if check_windows():
|
||||
os.system('cls')
|
||||
else:
|
||||
os.system('clear')
|
||||
os.system('cls') if check_windows() else os.system('clear')
|
||||
|
||||
def error(msg, reason=None):
|
||||
if reason:
|
||||
print('%s | [!] - %s (%s)' % (get_time(), msg, str(reason)))
|
||||
else:
|
||||
print('%s | [!] - %s' % (get_time(), msg))
|
||||
print(f'{get_time()} | [!] - {msg} ({str(reason)})') if reason else print(f'{get_time()} | [!] - {msg}')
|
||||
|
||||
def error_exit(msg):
|
||||
raise SystemExit('%s | [!] - %s' % (get_time(), msg))
|
||||
raise SystemExit(f'{get_time()} | [!] - {msg}')
|
||||
|
||||
def get_time():
|
||||
return time.strftime('%I:%M:%S')
|
||||
|
||||
def get_windows():
|
||||
if os.name == 'nt':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
return True if os.name == 'nt' else False
|
||||
|
||||
def info():
|
||||
clear()
|
||||
print(''.rjust(56, '#'))
|
||||
print('#{0}#'.format(''.center(54)))
|
||||
print('#{0}#'.format('Booster Twitter Bot'.center(54)))
|
||||
print('#{0}#'.format('Developed by acidvegas in Python 3'.center(54)))
|
||||
print('#{0}#'.format('Developed by acidvegas in Python'.center(54)))
|
||||
print('#{0}#'.format('https://acid.vegas/booster'.center(54)))
|
||||
print('#{0}#'.format(''.center(54)))
|
||||
print(''.rjust(56, '#'))
|
||||
|
||||
|
||||
def keep_alive():
|
||||
try:
|
||||
while True:
|
||||
|
@ -15,9 +15,7 @@ def get_source(url):
|
||||
source = urllib.request.urlopen(req, timeout=10)
|
||||
charset = source.headers.get_content_charset()
|
||||
if charset:
|
||||
return source.read().decode(charset)
|
||||
else:
|
||||
return source.read().decode()
|
||||
return source.read().decode(charset) if charset else return source.read().decode()
|
||||
|
||||
def random_int(min, max):
|
||||
return random.randint(min, max)
|
||||
|
@ -35,7 +35,7 @@ class Booster(object):
|
||||
threading.Thread(target=self.loop_favorite).start()
|
||||
threading.Thread(target=self.loop_follow).start()
|
||||
threading.Thread(target=self.loop_search).start()
|
||||
# threading.Thread(target=self.loop_trend).start()
|
||||
threading.Thread(target=self.loop_trend).start()
|
||||
|
||||
def login(self):
|
||||
try:
|
||||
@ -62,11 +62,11 @@ class Booster(object):
|
||||
def loop_favorite(self):
|
||||
while True:
|
||||
try:
|
||||
for tweet in tweepy.Cursor(api.home_timeline, exclude_replies=True).items(50):
|
||||
if tweet.user.screen_name != me.screen_name:
|
||||
for tweet in tweepy.Cursor(self.api.home_timeline, exclude_replies=True).items(50):
|
||||
if tweet.user.screen_name != self.me.screen_name:
|
||||
if not tweet.favorited:
|
||||
if random.choice((True, False, False, False, False)):
|
||||
api.create_favorite(tweet.id)
|
||||
self.api.create_favorite(tweet.id)
|
||||
self.favorites += 1
|
||||
debug.alert('Favorited a friends tweet!')
|
||||
time.sleep(30)
|
||||
@ -78,18 +78,18 @@ class Booster(object):
|
||||
def loop_follow(self):
|
||||
while True:
|
||||
try:
|
||||
followers = api.followers_ids(me.screen_name)
|
||||
friends = api.friends_ids(me.screen_name)
|
||||
followers = self.api.followers_ids(self.me.screen_name)
|
||||
friends = self.api.friends_ids(self.me.screen_name)
|
||||
non_friends = [friend for friend in followers if friend not in friends]
|
||||
debug.action('Following back {0} supporters...'.format(len(non_friends)))
|
||||
for follower in non_friends:
|
||||
api.create_friendship(follower)
|
||||
self.api.create_friendship(follower)
|
||||
self.follows += 1
|
||||
debug.alert('Followed back a follower!')
|
||||
if self.follows >= self.max_follows:
|
||||
break
|
||||
if self.send_message:
|
||||
api.send_direct_message(screen_name=follower, text=self.message)
|
||||
self.api.send_direct_message(screen_name=follower, text=self.message)
|
||||
time.sleep(30)
|
||||
except tweepy.TweepError as ex:
|
||||
debug.error('Error occured in the follow loop!', ex)
|
||||
@ -100,11 +100,11 @@ class Booster(object):
|
||||
while True:
|
||||
try:
|
||||
query = random.choice(config.boost_keywords)
|
||||
for item in api.search(q='#' + query, count=50, lang='en', result_type='recent'):
|
||||
for item in self.api.search(q='#' + query, count=50, lang='en', result_type='recent'):
|
||||
if not item.user.following and not item.favorited:
|
||||
try:
|
||||
api.create_favorite(item.id)
|
||||
api.create_friendship(item.user.screen_name)
|
||||
self.api.create_favorite(item.id)
|
||||
self.api.create_friendship(item.user.screen_name)
|
||||
self.favorites += 1
|
||||
self.follows += 1
|
||||
debug.alert('Followed a booster twitter!')
|
||||
@ -123,7 +123,7 @@ class Booster(object):
|
||||
hashtags = [x['name'] for x in trends[0]['trends'] if x['name'].startswith('#')]
|
||||
for trend in hashtags:
|
||||
for item in self.api.search(q=trend, count=5, lang='en', result_type='top'):
|
||||
#self.api.update_status(item.tweet) # FIX THIS PART
|
||||
self.api.update_status(item.tweet)
|
||||
time.sleep(30)
|
||||
except tweepy.TweepError as ex:
|
||||
debug.error('Error occured in the trend loop!', ex)
|
||||
@ -153,9 +153,9 @@ class Booster(object):
|
||||
def ratio_check(self):
|
||||
if self.follows >= max_follows:
|
||||
time.sleep(86400)
|
||||
if me.friends_count >= 2000:
|
||||
ratio = me.friends_count + (me.followers_count/10)
|
||||
if me.friends_count >= ratio:
|
||||
if self.me.friends_count >= 2000:
|
||||
ratio = self.me.friends_count + (self.me.followers_count/10)
|
||||
if self.me.friends_count >= ratio:
|
||||
debug.action('Following to follower ratio is off! Starting the unfollow loop...')
|
||||
unfollow_loop()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user