4

I have a fully working instagram bot which is made using instapy and it was working fine, I wanted to add a proxy to instagram so I added this code

session = InstaPy(username=insta_username,
password=insta_password,proxy_username='',proxy_password='',
                  proxy_address='8.8.8.8', 
          proxy_port=8080,
headless_browser=False)


with smart_run(session):
    #code here

I am using a premium proxy so that is not a problem for sure, I have read from the documentation to add this block of code, but I am gettig this error now

Custom workspace set: "C://Users//Nikhil//Downloads//forthemodernhouses//forthemodernhouses/InstaPy" :]
to be targetted 
  
 already dmmed
  ['livs.cosy.home2019', 'aceservices2021', 'inmovidal', 'gsmwindowsltd', 'braithwaite_gateway', 'fangting_properties']
final to be dmmed 
InstaPy Version: 0.6.13
 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
Workspace in use: "C://Users//Nikhil//Downloads//forthemodernhouses//forthemodernhouses/InstaPy"
WARNING [2021-05-23 12:39:53] [forthemodernhouses]  Proxy Authentication is not working anymore due to the Selenium bug report: https://github.com/SeleniumHQ/selenium/issues/7239
WARNING [2021-05-23 12:39:55] [forthemodernhouses]  Unable to proxy authenticate
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2021-05-23 12:39:55] [forthemodernhouses]  Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo

the proxy requires a authentication, so ive added proxy username and password , but as the error says selenioum does not support it, So is there any other way I can add the proxy(not manually), then how

Nikhil Singh
  • 353
  • 1
  • 17
  • The `WARNING` suggests you have a broken connection and since you mention that your script **works** fine without proxy, its a good idea to double check your proxy connection. Also, you mention you are using a **premium** proxy, perhaps it requires authentication too and in that case you need to pass on extra parameters like [this](https://instapy.org/instance-settings#use-a-proxy) – vyi May 18 '21 at 20:11
  • I bought a new proxy and have edited my question can you please have alook at it agian – Nikhil Singh May 23 '21 at 07:14
  • What happens when you set `headless_browser=True` ? – vyi May 23 '21 at 10:40
  • I think it will run the process in a headless_browser i.e without visual display of the browser , anywhich ways I dont want a headless one ,because it increases tha chance of getting banned, also I dont think it has anything to do with proxy – Nikhil Singh May 23 '21 at 17:55
  • 1
    1) It is possible to get banned. Perhaps try the `headless_browser=True` just to see if connection goes through and not perform any activity to look suspicious. 2) In the above post you set proxy_username='' (blank) OR proxy_username="some_blah" etc? 3) The selenium error **7239** might require you to use some other method for auth. Can you use try with different browser using the following two parameters `want_check_browser=True` and `browser_executable_path=/...firefox.exe OR /.../chrome.exe`. – vyi May 23 '21 at 19:53
  • - Internet Connection Status: error Unable to login to Instagram! You will find more information in the logs above. Firstly, provide **log output** for debugging purposes... Secondly, The error says you are unable to log into instagram due to weak or no internet. *Check if you are able to log into instagram with your proxy in your normal browser.* – huzefausama May 23 '21 at 03:51
  • in the newest version for instapy support has already ended for chromedriver – Nikhil Singh May 24 '21 at 05:33
  • @vvy yes i added blank just not to reveal my proxy, second thing ,I tried headles browser ,doesnt work either – Nikhil Singh May 24 '21 at 05:34

2 Answers2

1

To avoid entering proxy-credentials manually you may try the following 2 options:

  1. Create a browser extension as mentioned here and call it before your InstaPy session

  2. Use the url authentication with selenium before you start your InstaPy session: source

    from selenium import webdriver  
    driver = webdriver.Firefox()  
    driver.get("https://username:password@host:port")  
vyi
  • 1,078
  • 1
  • 19
  • 46
  • thank you for this answer ,I tried your second method ,but I am gettin this error selenium.common.exceptions.webdriverexception: message: reached error page: about: – Nikhil Singh May 24 '21 at 15:38
  • and I dont want to do it through an extension – Nikhil Singh May 24 '21 at 15:39
  • I have already posted it, after this the session ended directly – Nikhil Singh May 25 '21 at 13:27
  • 1
    `webdriverexception: message: reached error page: about:` suggests **url** authentication via get request on `https://username:password@host:port` is not supported by the Proxy server. Can you confirm this by manually entering this on a new tab of your browser ? – vyi May 25 '21 at 20:50
  • This site can’t provide a secure connection sent an invalid response. Try running Windows Network Diagnostics. ERR_SSL_PROTOCOL_ERROR, this is what i got manually – Nikhil Singh May 26 '21 at 20:45
1

I had the same problem. I've tried to change browser.py to use seleniumwire instead of selenium and it has worked great for me.

buddemat
  • 4,552
  • 14
  • 29
  • 49