-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb_scrap.py
45 lines (44 loc) · 2.02 KB
/
web_scrap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from selenium.webdriver.chrome.options import Options
import time
from selenium.webdriver.common.by import By
from undetected_chromedriver import Chrome
from bs4 import BeautifulSoup
from datetime import datetime
HEADER={
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35",
"Accept-Language":"en-GB,en;q=0.9,en-US;q=0.8"
}
#Development Stoped Related to Auto webscaping with Blessi......
#Soon we will work on it as well
class WebScrap():
def __init__(self):
self.date_today=datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self.chrome_options = Options()
for key, value in HEADER.items():
self.chrome_options.add_argument(f"--header={key}:{value}")
self.driver = Chrome(options=self.chrome_options)
def Search(self,url):
while True:
try:
self.driver.get(url)
time.sleep(4)
login=self.driver.find_element('xpath','/html/body/div[1]/div[1]/div[1]/div[4]/button[1]')
login.click()
time.sleep(5)
google=self.driver.find_element('xpath','/html/body/div/main/section/div/div/div/div[4]/form[2]/button')
google.click()
time.sleep(3)
user_input=self.driver.find_element('xpath','//*[@id="identifierId"]')
user_input.send_keys(my_email)
user_next=self.driver.find_element('xpath','//*[@id="identifierNext"]/div/button')
user_next.click()
time.sleep(6)
password_input=self.driver.find_element('xpath','//*[@id="password"]/div[1]/div/div[1]/input')
password_input.send_keys(passw)
time.sleep(1)
password_next=self.driver.find_element('xpath','//*[@id="passwordNext"]/div/button')
password_next.click()
time.sleep(13)
break
except:
print('There is some Error')