Skip to content

Commit e4ea114

Browse files
authored
Add files via upload
1 parent a442a9c commit e4ea114

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Zomato Scraper/zomato.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import re
2+
from selenium.webdriver.common.keys import Keys
3+
from bs4 import BeautifulSoup
4+
import time
5+
from selenium import webdriver
6+
7+
driver = webdriver.Chrome()
8+
url = "https://zomato.com/ahmedabad/restaurants/cafes?category=2"
9+
driver.get(url)
10+
html = driver.page_source
11+
soup = BeautifulSoup(html, "html.parser")
12+
13+
container = soup.find("div",{"id":"root"})
14+
i = 0
15+
16+
while True:
17+
i = 0
18+
for items in container.find_all("div",class_=re.compile("sc-1mo3ldo-0 sc-")):
19+
if i==0:
20+
i = 1
21+
continue
22+
print(items.text)
23+
first_child = items.find("div")
24+
for item in first_child:
25+
link = item.find("a",href=True)['href']
26+
print(link)
27+
name = item.find("h4")
28+
print(name.text)
29+
rating = item.find("div",{"class":"sc-1q7bklc-1 cILgox"})
30+
print(rating.text)
31+
cusine = item.find("p")
32+
print(cusine.text)
33+
rate = item.find("p").next_sibling
34+
print(rate.text)

0 commit comments

Comments
 (0)