What’s the js alternative of this python script:
from bs4 import BeautifulSoup as bs
import requests
page = requests.get(url).text
soup = bs(page)
items = soup.findAll('li')
I’ve searched DOM Parser documentation but i can’t find anything like findall()
.
Can someone help me?
2
Answers
Try Doing this
items = soup.findAll(‘li’, class=’ClassNameofthatparticularli’ )
I hope this might work for you. If not ask me again.
You can call all the method supported by the Document interface on the
doc
constant in this code snippet. Here I used thequerySelectorAll
method that returns aNodeList
containing allli
elements in the document.