Is there a way to run selenium on Instapy with Android? I need to work with some feature only available on mobile (upload pictures, stories, direct message etc...).
session = InstaPy(username=username,
password=password,
headless_browser=False,
)
session.set_selenium_remote_session(
selenium_driver=webdriver.Remote(
command_executor='',
desired_capabilities=DesiredCapabilities.ANDROID))
session.login()
I tried with this code, but do not work properly.
Does someone can help me?
Thanks :)
I solved.
If someone need the code, here it is:
mobile_emulation = {
"deviceMetrics": {"width": 360, "height": 640, "pixelRatio": 3.0},
"userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"}
chrome_options = Options()
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
def start():
session = InstaPy(username=username,
password=password,
headless_browser=False,
selenium_local_session=False
)
session.browser = webdriver.Chrome(chrome_options=chrome_options)
session.login()
Oh this code works as well so you can make what you want with the already implemented function on Instapy.
I solved.
If someone need the code, here it is:mobile_emulation = { "deviceMetrics": {"width": 360, "height": 640, "pixelRatio": 3.0}, "userAgent": "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19"} chrome_options = Options() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) def start(): session = InstaPy(username=username, password=password, headless_browser=False, selenium_local_session=False ) session.browser = webdriver.Chrome(chrome_options=chrome_options) session.login()
Oh this code works as well so you can make what you want with the already implemented function on Instapy.
This is the most underrated feature here, this fix can be used to integrate sending direct messages and other features which are not allowed in the desktop web version of instagram.
Hi @joshuachinemezu !
Can you explain me how to set an automatic message for everyone who follows me on instagram?
Is there a template or something else?
Thanks in advance!
Hello @MatteoGamberini
Yes, I have a snippet of code that I use for this sort of operation. I will check the codebase of the project over the weekend and share it with you.
Thanks in advance!
Il giorno gio 12 mar 2020 alle ore 17:45 Joshua Chinemezu <
[email protected]> ha scritto:
Hello @MatteoGamberini https://github.com/MatteoGamberini
Yes, I have a snippet of code that I use for this sort of operation. I
will check the codebase of the project over the weekend and share it with
you.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/timgrossmann/InstaPy/issues/4496#issuecomment-598292388,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AM7T7WOAENQ3ASJTR22COL3RHEGRNANCNFSM4HSAH5KQ
.
Hi @joshuachinemezu Hope you didn't forget about the snippet code :)
If you could send it to me I would be very grateful to you.
Thanks!
Matteo.
Il giorno gio 12 mar 2020 alle ore 17:45 Joshua Chinemezu <
[email protected]> ha scritto:
Hello @MatteoGamberini https://github.com/MatteoGamberini
Yes, I have a snippet of code that I use for this sort of operation. I
will check the codebase of the project over the weekend and share it with
you.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/timgrossmann/InstaPy/issues/4496#issuecomment-598292388,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AM7T7WOAENQ3ASJTR22COL3RHEGRNANCNFSM4HSAH5KQ
.
Hi @joshuachinemezu if you can share your code it would be great!
Hello any update ?
@joshuachinemezu Could you please share the code for sending DM?
@mannderkatzen Prior to Instagram's updated web version, you can now send DMs on the web. I will make a pull request for this once I have time over the weekend.
@MatteoGamberini @edoardodenigris @Alistorm Apologies for the late response. I have been terribly busy during this covid period. I will make a pull request for this feature once I am free over the weekend.
@MatteoGamberini @edoardodenigris @Alistorm @mannderkatzen
I just checked the code base and found out I used a custom-built python class for the function of sending DMs, the link to this class is here
Sample Usage:
from instagram import InstagramAPI
def instagram_config():
connect = InstagramAPI(instagram_username, instagram_password)
connect.login()
return connect
def send_message(username):
api = instagram_config()
api.searchUsername(username)
response = api.LastJson
user_id = response['user']['pk']
send_msg = api.direct_message(message, user_id)
print(send_msg)
Let me know if this helps and don't hesitate to let me know if you have any issue.
Most helpful comment
I solved.
If someone need the code, here it is:
Oh this code works as well so you can make what you want with the already implemented function on Instapy.