Reputation: 73
I am trying to scrape an attribute from but I must doing something wrong because I cant´t get it.
this is my code
import requests
from bs4 import BeautifulSoup
url = 'https://www.pccomponentes.com/procesadores'
headers = ({'User-Agent':
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36',
'Accept-Language': 'es-ES, es;q=0.5'})
page = requests.get(url,headers=headers)
soup = BeautifulSoup(page.content,'html.parser')
product = soup.find('div',class_ = 'col-xs-6 col-sm-4 col-md-4 col-lg-4')
#print(product)
brand = product.find('a', attrs={'class': 'c-product-card__title-link cy-product-link'})['data-brand']
print(brand)
The target is to obtain "AMD".
Any help would be much appreciate.
Regards
Upvotes: 0
Views: 111
Reputation: 25196
The following implies that the Cloudflare have detected your requests to the website as an automated bot and subsequently denying you the access to the application.
Because of that you wont find any of your expected information but you may take a look at Python's requests triggers Cloudflare's security while urllib does not
Upvotes: 1