python - Filtering into specific class in BeautifulSoup -


i doing using beautifulsoup:

for name in soup.find_all('div','name'): 

when using filter, understanding div tags attribute or class name name.

however, don't want every instance of div tag attribute name. want instances in locate in subtree of html file. more specifically, instances within tag <u1 class="list-box mb-3 spacer">...<u1\>, 2 levels above tags looking for. question is, how write filter in soup.find_all() zoom class?

i apologize in advance if had mixed terminology. first time attempting web scraping. not sure @ within documentation.

for reference, website attempting web scraping on: http://pd.appbank.net/ml39

you can't specify search tags within parent directly, can use nested loop done. first, ul tags class list-box mb-3 spacer, , divs located under each one.

div_list = []  ul in soup.find_all('ul', {'class' : 'list-box mb-3 spacer'}):     div_list.extend(ul.find_all('div', {'class' : 'name'}))  print(div_list) 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -