jeudi 27 février 2020

code seems to be right. Yet I'm getting error and getting output as None. Please help me with this [closed]

import requests
from bs4 import BeautifulSoup

url = 'https://www.amazon.in/Samsung-Galaxy-Storage-Additional-Exchange/dp/B084455L75/ref=sr_1_1?crid=EEW6CELM3G00&keywords=s20+samsung+phone&qid=1582739113&sprefix=s20%2Caps%2C369&sr=8-1'

headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36'}

page = requests.get(url, headers=headers)

soup = BeautifulSoup(page.content, 'html.parser')

title = soup.find(id="productTitle")

print(title)

1




Aucun commentaire:

Enregistrer un commentaire