From 49cef8ebbf2ebe703496d4ee385d23e197b2fdc9 Mon Sep 17 00:00:00 2001 From: simran1901 Date: Sat, 31 Oct 2020 20:29:54 +0530 Subject: [PATCH] adding web.py --- web1.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 web1.py diff --git a/web1.py b/web1.py new file mode 100644 index 0000000..72f1290 --- /dev/null +++ b/web1.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +""" +Created on Sun Aug 16 00:44:55 2020 + +@author: Makhijani's +""" + + +import requests +from bs4 import BeautifulSoup + +url = "https://www.flipkart.com/search?q=mobiles&as=on&as-show=on&otracker=AS_Query_TrendingAutoSuggest_1_0_na_na_na&otracker1=AS_Query_TrendingAutoSuggest_1_0_na_na_na&as-pos=1&as-type=TRENDING&suggestionId=mobiles&requestId=994e1fc4-4bee-4da2-83c9-ff6663b2e0da" + +#get the HTML +r = requests.get(url) +htmlContent = r.content +#print(htmlContent) +soup = BeautifulSoup(htmlContent, 'html.parser') + +job_elems = soup.find_all('div', class_='_1HmYoV _35HD7C') + +for job in job_elems: + product = job.find_all('div', class_='_3wU53n') + for pr in product: + print(pr.text)