File size: 578 Bytes
0bd6e09
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import http.client
from bs4 import BeautifulSoup
import json

conn = http.client.HTTPSConnection("www.amazon.in")
payload = ''
headers = {}
conn.request("POST", "/dp/B0BJMCKYCY/", payload, headers)
res = conn.getresponse()
data = res.read()
response = data.decode("utf-8")
soup = BeautifulSoup(response, features="html5lib")
data = soup.find_all("script")
dataArr = {}
for i in data:
    try:
        temp = str(i).split("<script")[1].split(">")[1].split("</script")[0]
        for key, item in json.loads(temp).items():
            dataArr[key] = item
    except:
        pass