Skip to content

Commit

Permalink
v2.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwickerhf committed Dec 6, 2020
1 parent 944c4d5 commit 4c505d4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
19 changes: 14 additions & 5 deletions instaclient/client/instaclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,10 +1059,19 @@ def __dismiss_dialogue(self, wait_time:float=2.5):


def __press_button(self, button):
button.click()
time.sleep(randrange(0,2))
self.__detect_restriction()
return True
try:
button.click()
time.sleep(randrange(0,2))
self.__detect_restriction()
return True
except:
x = self.__find_element(EC.presence_of_element_located((By.XPATH, Paths.X)), wait_time=3)
x.click()
time.sleep(1)
button.click()
time.sleep(randrange(0,2))
self.__detect_restriction()
return True


def __detect_restriction(self):
Expand Down Expand Up @@ -1104,7 +1113,7 @@ def __init_driver(self, login=False, retries=0, func=None):
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = os.environ.get("GOOGLE_CHROME_BIN")
chrome_options.add_argument('--user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1')
chrome_options.add_argument("--window-size=343,915")
chrome_options.add_argument("--window-size=414,896")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--no-sandbox")
Expand Down
1 change: 1 addition & 0 deletions instaclient/client/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Paths:
# Like Feed Posts
LIKE_BTN = ''
# GENERAL
X = '//div[@class="_7UhW9 xLCgt MMzan KV-D4 uL8Hv "]'
COOKIES_LINK = '//a[contains(@heref, "cookies") or contains(text(), "Cookie")]'
ACCEPT_COOKIES = '//button[@class="aOOlW bIiDR "]'
SETTINGS_BTN = '//button[@class="Q46SR"]'
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
setup(
name = 'instaclient', # How you named your package folder (MyLib)
packages = find_packages(exclude=['tests, drivers']), # Chose the same as "name"
version = '2.1.11', # Start with a small number and increase it with every change you make
version = '2.1.12', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'Instagram client built with Python 3.8 and the Selenium package.',
long_description=README,
long_description_content_type="text/markdown",
author = 'David Wicker', # Type in your name
author_email = 'davidwickerhf@gmail.com', # Type in your E-Mail
url = 'https://github.com/wickerdevs/py-instaclient', # Provide either the link to your github or to your website
download_url = 'https://github.com/wickerdevs/py-instaclient/archive/v2.1.11.tar.gz', # I explain this later on
download_url = 'https://github.com/wickerdevs/py-instaclient/archive/v2.1.12.tar.gz', # I explain this later on
keywords = ['INSTAGRAM', 'BOT', 'INSTAGRAM BOT', 'INSTAGRAM CLIENT'], # Keywords that define your package best
install_requires=[ # I get to this in a second
'selenium',
Expand Down

0 comments on commit 4c505d4

Please sign in to comment.