-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGI.PY
More file actions
27 lines (23 loc) · 736 Bytes
/
Copy pathGI.PY
File metadata and controls
27 lines (23 loc) · 736 Bytes
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
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from bs4 import BeautifulSoup
import requests
import time
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--incognito")
driver = webdriver.Chrome(r"C:\chromedriver")
x=0
driver.get("https://www.flipkart.com")
content = driver.page_source
soup =BeautifulSoup(content,features="html.parser")
for a in soup.findAll('a',href=True):
if a.img:
try :
url =a.img['src']
r = requests.get(url)
x+=1
f=open("%s.jpg"%x,'wb')
f.write(r.content)
except Exception:
continue
print(x)