<jupyter_start><jupyter_text>Import required libraries and get the response from URL<jupyter_code>from bs4 import BeautifulSoup
import requests
import pandas as pd

res = requests.get("https://www.amazon.in/Omron-Automatic-Intellisense-Technology-Measurement/dp/B00F38B3NW/ref=lp_21246947031_1_1?srs=21246947031&ie=UTF8&qid=1585845401&sr=8-1")
# If 200 that means response was successfully received 
print(res)<jupyter_output><Response [503]><jupyter_text>Create a beautiful soup object with the response<jupyter_code>soup = BeautifulSoup(res.content,"lxml")<jupyter_output><empty_output><jupyter_text>There are multiple ways to select different elements but css selector is used here<jupyter_code>prodName = soup.select("#productTitle")[0].string.strip()
prodName
price = soup.select("#priceblock_ourprice")[0].string.strip()
price[2:]<jupyter_output><empty_output><jupyter_text>Put the data inside a dataframe and save it to a csv file for future use(if any)<jupyter_code>lst = {'Name' : [prodName], 'Price' : [price]}

df = pd.DataFrame(lst)
df
df.to_csv('file.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11828935395814377, 'fraction_numerical': 0.047315741583257506, 'mean_word_length': 8.482758620689655, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '551535', 'license': 'MIT', 'n_tokens_mistral': 416, 'n_tokens_neox': 383, 'n_words': 80, 'path': 'web scraping.ipynb', 'repo_name': 'ashide2729/Python-web-scraping-tutorial', 'size': '1099'}