I am using BeautifulSoup to get all links of mobile phones from this url http://www.gsmarena.com/samsung-phones-f-9-0-p2.php
My code for the following is :
Taken from http://www.crummy.com/software/BeautifulSoup/download/2.x/documentation.html:
For instance, if you wanted to get only "a" Tags that had non-empty "href" attributes, you would call
soup.fetch('a', {'href':re.compile('.+')})
. If you wanted to get all tags that had an "width" attribute of 100, you would callsoup.fetch(attrs={'width':100})
.
Try this: data = soup.findAll('div',attrs={'class':re.compile('.+')});
Should fetch all the divs with a class property present and not empty.