Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
azizkpln
GitHub Repository: azizkpln/moriarty-project
Path: blob/master/Investigation/socialMedia2.py
193 views
1
import asyncio
2
from playwright.async_api import async_playwright
3
from pyvirtualdisplay import Display
4
import time
5
def printAll():
6
return instAc
7
async def run(playwright,phone_number):
8
global page
9
global instAc
10
firefox = playwright.firefox
11
browser = await firefox.launch(headless=True)
12
context = await browser.new_context()
13
page = await context.new_page()
14
await page.goto("https://www.instagram.com/accounts/login/")
15
await page.locator('[name="username"]').fill(phone_number[0])
16
await page.locator('[name="password"]').fill(phone_number[0])
17
await page.click('button:has-text("Log In")')
18
try:
19
try:
20
await page.text_content('p:has-text("Sorry, your password was incorrect. Please double-check your password.")',timeout=3000)
21
instAc="True"
22
except:
23
try:
24
await page.text_content('p:has-text("a problem")',timeout=3000)
25
instAc="_False_"
26
except:
27
instAc="False"
28
except:
29
instAc="False"
30
await browser.close()
31
async def instaMain(phone_number):
32
async with async_playwright() as playwright:
33
await run(playwright,phone_number)
34
35