The problem is that not all of the div
elements on the page have id
attribute.
You should narrow down the search by providing either the class name or id atrribute to find_all()
:
for div in soup.find_all("div", {'class': 'filmo-row'}):
print div.get('id')
or, for example, you can check if div
has an id
attribute that contains writer-
text by using re
module:
for div in soup.find_all("div", {'id': re.compile('writer-'}):
print div.get('id')
Hope that helps.