Jun-07-2021, 07:09 PM
(This post was last modified: Jun-07-2021, 07:25 PM by Led_Zeppelin.)
I am trying to run the code shown below. It fails at the line indicated as shown in this error;
I am using python 3.8.10 on Windows 10 64 bit.
The code for the program is as follows:
There are alternative inputs for
soup = BeautifulSoup(html,'lxml')
I have tried a few and nothing works.
Please inform a to how to remove error.
Respectfuly,
LZ
FeatureNotFound Traceback (most recent call last)
<ipython-input-9-42bc73e2ba3f> in <module>
----> 1 soup = BeautifulSoup(html, 'lxml')
~\miniconda3\lib\site-packages\bs4\__init__.py in __init__(self, markup, features, builder, parse_only, from_encoding, exclude_encodings, element_classes, **kwargs)
241 builder_class = builder_registry.lookup(*features)
242 if builder_class is None:
--> 243 raise FeatureNotFound(
244 "Couldn't find a tree builder with the features you "
245 "requested: %s. Do you need to install a parser library?"
FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library? I am using beautiful soup 4.9.3 and bs4 0.0.1I am using python 3.8.10 on Windows 10 64 bit.
The code for the program is as follows:
from bs4 import BeautifulSoup
import requests
import re
import time
import random
import sys
import numpy as np
import pandas as pd
from selenium import webdriver
import chromedriver_binary
link = 'https://finance.yahoo.com/quote/AAPL/financials?p=AAPL'
url = link
user_agent = {'User-agent': 'Mozilla/5.0'}
response = requests.get(url, headers = user_agent)
# !pip install chromedriver-binary==79.0.3945.36
# !pip install selenium
driver = webdriver.Chrome()
driver.get(link)
html = driver.execute_script("return document.body.innerHTML;")
soup = BeautifulSoup(html, 'lxml') There are alternative inputs for
soup = BeautifulSoup(html,'lxml')
I have tried a few and nothing works.
Please inform a to how to remove error.
Respectfuly,
LZ
