Spaces:
Sleeping
Sleeping
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 | |