File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments