I am trying to parse a webpage and print the link for items(href). Can you help with where am i going wrong?
import requests
from bs4 import BeautifulSoup
link = "https://www.amazon.in/Power-
Banks/b/ref=nav_shopall_sbc_mobcomp_powerbank?ie=UTF8&node=6612025031"
def amazon(url):
sourcecode = requests.get(url)
sourcecode_text = sourcecode.text
soup = BeautifulSoup(sourcecode_text)
for link in soup.findALL('a', {'class': 'a-link-normal aok-block a-
text-normal'}):
href = link.get('href')
print(href)
amazon(link)
Output :
C:\Users\TIMAH\AppData\Local\Programs\Python\Python37\python.exe "C:/Users/TIMAH/OneDrive/study materials/Python_Test_Scripts/Self Basic/Class_Test.py" Traceback (most recent call last): File "C:/Users/TIMAH/OneDrive/study materials/Python_Test_Scripts/Self Basic/Class_Test.py", line 15, in amazon(link) File "C:/Users/TIMAH/OneDrive/study materials/Python_Test_Scripts/Self Basic/Class_Test.py", line 9, in amazon soup = BeautifulSoup(sourcecode_text, 'features="html.parser"') File "C:\Users\TIMAH\AppData\Local\Programs\Python\Python37\lib\site-packages\bs4__init__.py", line 196, in init % ",".join(features)) bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: features="html.parser". Do you need to install a parser library?
Process finished with exit code 1