Пример #1
0
def main(login, password, gf_account):
    bot = InstagramBot(
        login=login,
        password=password,
        target=gf_account,
    )
    bot.like_all_users_media()
Пример #2
0
    def __init__(self, bot, update, users_database_location,
                 activities_db_address):
        self.callback_data = {
            "_flw": self._followButton,
            "_auto": self._automaticModeButton,
            "_unflw": self._unfollowButton,
            "_links": self._showLinksButton
        }

        self.query = update.callback_query
        self.data = self.query.data
        self.bot = bot
        self.new_time = datetime.now()
        self.jso = InteractWithUser.java_script_object
        self.username = self.jso.username
        self.password = self.jso.password

        self.datetime_format = '%Y-%m-%d %H:%M:%S.%f'
        self.user_database_name = str(self.query.message.chat_id) + '.db'
        self.user_db_address = users_database_location + self.user_database_name
        self.bot_act_db_address = activities_db_address

        self.connection = sqlite3.connect(self.bot_act_db_address)
        self.cursor = self.connection.cursor()

        self.action = self.cursor.execute('SELECT * FROM telegram_button')
        self.fetch_all = self.action.fetchall()

        self.insta_bot = InstagramBot(self.username, self.password,
                                      self.user_db_address,
                                      self.bot_act_db_address)
Пример #3
0
def main():
    bot = InstagramBot(login='******',
                       password='******',
                       target='account_name_of_your_gf')
    bot.like_all_users_media()
Пример #4
0
        founded = re.findall('/p/\w+', photo_url)

        if len(founded) > 0:
            photo_urls.append(photo_url)
    return photo_urls


def like_all_photos(driver, photos_url):
    for photo_url in photo_urls:
        driver.get(photo_url)
        time.sleep(2)
        # like an open picture
        try:
            driver.find_element_by_xpath('//*[@aria-label=\"Like\"]').click()
        except Exception:
            #probably already liked, skip
            print('probably already liked')


driver = webdriver.Chrome()

instagram_bot = InstagramBot(driver, USERNAME, PASSWORD)
instagram_bot.login_to_profile()

#when you are at a persons page like all their pics
driver.get(PERSON_URL)
time.sleep(2)

photo_urls = scroll_to_buttom_of_screen_and_get_pics_url(driver)
like_all_photos(driver, photo_urls)
Пример #5
0
    def setUp(self):
        time.sleep(10)

        self.insta_bot = InstagramBot(self.username, self.password,
                                      self.user_database_address,
                                      self.bot_act_db_address)
Пример #6
0
class TestBot(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.username = "******"
        cls.password = "******"

        cls.user_database_address = users_db_location + "459185918" + ".db"
        cls.bot_act_db_address = activities_db_location + "459185918" + "_activities.db"

        connectToBotActivitiesDatabase(cls.bot_act_db_address,
                                       activities_limit_per_day=100)

    def setUp(self):
        time.sleep(10)

        self.insta_bot = InstagramBot(self.username, self.password,
                                      self.user_database_address,
                                      self.bot_act_db_address)

    def tearDown(self):
        self.insta_bot.driver.close()

    def test_a_show_links(self):
        bot_acts = self.insta_bot._showLinks(self.bot_act_db_address,
                                             "telegram_button")
        acts = bot_acts[1]
        print_acts(acts)

        bot_acts = self.insta_bot._showLinks(self.bot_act_db_address,
                                             "insta_permanent_activities")
        acts = bot_acts[1]
        print_acts(acts)

        bot_acts = self.insta_bot._showLinks(self.bot_act_db_address,
                                             "insta_temporary_activities")
        acts = bot_acts[1]
        print_acts(acts)

        bot_acts = self.insta_bot._showLinks(self.user_database_address,
                                             "followers")
        acts = bot_acts[1]
        print_acts(acts)

        bot_acts = self.insta_bot._showLinks(self.user_database_address,
                                             "following")
        acts = bot_acts[1]
        print_acts(acts)

    @ignore_warnings
    def test_b_follow(self):
        self.insta_bot._login()
        self.insta_bot._updateLinks()
        self.insta_bot._follow()

    @ignore_warnings
    def test_c_like_follower(self):
        self.insta_bot._login()
        self.insta_bot._updateLinks()
        self.insta_bot._likeTimeLine()

    @ignore_warnings
    def test_d_stop_tracking(self):
        self.insta_bot._login()
        self.insta_bot._updateLinks()
        self.insta_bot._stopTracking()
Пример #7
0
    print("---------------------------------------\n")


print("-------------Instagram Bot-------------")
print("---------------------------------------")

while True:
    print("Please enter your Instagram credentials")

    username = input("Username (not email): ")
    password = getpass()

    print_with_lines("LOGGING IN TO YOUR ACCOUNT...")

    try:
        bot = InstagramBot(username, password)
    except:
        # The page didn't load either because the user's internet connection is bad/they don't have internet, or they entered the wrong credentials
        print(
            "The bot wasn't able to log in to your Instagram account because of one of two reasons:\n1. You entered the wrong credentials\n2. You have a slow internet connection or you aren't connected to the internet\n"
        )
        continue

    while True:
        print("Select an option (type the number)")
        print("---------------------------------------")
        print("1. Check who's not following you back")
        print("2. Use different Instagram account")
        print("3. Quit")
        chosen_option = input(": ")
Пример #8
0
from instagram_bot import InstagramBot
from weather import Weather, Unit
from os import path
import re
import json
"""
TODO:
    - Weather API not working anymore, replace with better one
"""

# Initialize InstagramBot
ig = InstagramBot()

# Get today's weather forcast
# TODO: Weather API no longer working
weather = Weather(unit=Unit.CELSIUS)
location = weather.lookup('4118')  # Toronto WOEID
forecast = location.forecast[0]
sunrise = location.astronomy['sunrise']
sunset = location.astronomy['sunset']

# Correct sunset if incorrect
# (e.g. might return "7:3 pm")
if not re.match("^[0-1]?[0-9]:[0-5][0-9] (am|pm)$", sunset):
    sunset = ":0".join(sunset.split(":"))

# Craft weather message
weather_emojis = json.load(
    open(path.dirname(__file__) + '/weather_emojis.json'))
report = (f"Weather: {forecast.text} {weather_emojis[forecast.code]}\n"
          f"🔺{forecast.high}ºC 🔻{forecast.low}ºC\n"
import time
from instagram_bot import InstagramBot
from telegram_bot import TelegramBot

engagement_limit = 24

#make sure that 30 other hrefs have been added before going again

while True:
    #print ('Waiting 1 hour...')
    #time.sleep(3600)
    ig = InstagramBot()
    latest_post = ig.get_latest()

    tb = TelegramBot()
    post_list = tb.get_posts()
    tb.engage_posts(engagement_limit, post_list)
    tb.post_latest(latest_post, engagement_limit)
Пример #10
0
from instagram_bot import InstagramBot

# Initiate bot
ig = InstagramBot()

# Likes a post given the post's url
# Returns username if return_user
# (return_user = False by default)
url = 'https://www.instagram.com/p/BnZBdTVluBA/'
username = ig.like(url, return_user = True)

# Like a user's first p posts given
# their username and the number of posts
# (p = 3 by default)
username = '******'
ig.like_user(username, p=5)

# Like the first p posts of the first u users
# on from a hashtag page given the hashtag,
# number of users and number of posts
# (u = 5, p = 3 by default)
hashtag = 'torontoclx'
ig.like_hashtag(hashtag, u=3, p=5)

# Example usage over list of hashtags:
hashtags = ['bokeh_kings', 'moodygang', 'eclectic_shotz',
        'falltrapz', 'bokeh_shotz', 'moodygrams',
        'depthobsessed', 'bokehkillers', 'torontoclx',
        'filmtronic', 'depthofearth', 'heatercentral',
        'moodyfilm', 'houseoftones', 'visualambassadors',
        'under3kyo', 'shotz_fired', 'yngkillers',
from selenium import webdriver
import chromedriver_binary  # Adds chromedriver binary to path
import time
from instagram_bot import InstagramBot

# Script to find who doest follow you back
# TODO find a safe way to store the password and email
USERNAME = ""
PASSWORD = ""

driver = webdriver.Chrome()

instagram_bot = InstagramBot(driver, USERNAME, PASSWORD)
print(instagram_bot.find_not_follow_back_people())