I think there is a problem when the "div" tags are too nested. I am trying to parse some contacts from the httml facebook file, and Beautifulsoup cannot find the "div" tags with the "fcontent" class.
This also happens with other classes. When I look for divs in general, it turns only those that are not so much nested.
The html source code can be any page from facebook from your friend’s friend list (and not from your friends). If someone can check this out and give some advice, I would really appreciate it.
This is my code where I am just trying to print the number of "div" tags with the "fcontent" class:
from BeautifulSoup import BeautifulSoup f = open('/Users/myUserName/Desktop/contacts.html') soup = BeautifulSoup(f) list = soup.findAll('div', attrs={'class':'fcontent'}) print len(list)
omar Mar 04 2018-10-10T00: 00-03
source share