I am wondering how could I use BeautifulSoup to parse this style (javascript?) of tag attributes in the following html code:
<div class="class1" data-prop="{personName: 'Claudia', personCode:'123456'}">
...
</div>
I'm currently just following standard process until I reach the contents of the attribute which I am currently parsing using regexp, however I'd like to know if there are better/faster/more elegant options:
soup = BeautifulSoup(data,'html.parser')
class_element = soup.find("div", class_="class1")
data-props=class_element['data-prop']
# Parsing using regexp goes here
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment