title: Parser Issue with BeautifulSoup
body: <p>I have a script that loops through multiple pages and it is working fine until it gets to page 19.  I get the error message:</p>
  
  <pre><code>if container.find(text="License: ").nextSibling.img:
  AttributeError: 'NoneType' object has no attribute 'nextSibling'
  </code></pre>
  
  <p>That element exists on page 19. I have also included an else statement for when it doesn't.  I have tried <code>requests</code> instead of <code>urlopen</code> to see if that makes a difference and have even changed the parser from <code>html.parser</code> to <code>html5lib</code> to <code>lxml</code> with no luck. I think it might be a parser issue but I am not sure what the solution might be.  Here is my script:</p>
  
  <pre><code>from urllib.request import urlopen
  from bs4 import BeautifulSoup as soup
  import json
  
  base_url = "https://www.doabooks.org/"
  
  data = []
  n = 85
  for i in range(1, n+1):
      if (i == 1):
      # handle first page
         response = urlopen(base_url)
      response = urlopen(base_url + "doab?func=browse&amp;page=" + str(i) + "&amp;queryField=A&amp;uiLanguage=en")
      page_html = response.read()
      response.close()
  
      #html parsing
      page_soup = soup(page_html, "html5lib")
  
      #grabs info for each book
      containers = page_soup.findAll("div",{"class":"data"})
  
      for container in containers:
         item = {}
         item['type'] = "Open Access Book"
         item['title'] = container.span.text.strip()
         item['author'] =container.a.text
         item['link'] = "https://www.doabooks.org" + container.find('a', {'itemprop' : 'url'})['href']
         item['source'] = "Directory of Open Access Books"
         if container.div.find('a', {'itemprop' : 'about'}):
            item['subject'] = container.div.find('a', {'itemprop' : 'about'}).text.lstrip()
         else: 
            item['subject'] = ''
         item['base_url'] = "https://www.doabooks.org/"
         if container.find(text="License: ").nextSibling.img:
             item['license'] = container.find(text="License: ").nextSibling['href']
         else:
             item['license'] = container.find(text="License: ").nextSibling.text
  
         item['license_url'] = container.find(text="License: ").nextSibling['href']
         data.append(item) # add the item to the list
  
     with open("./json/doab-a.json", "w") as writeJSON:
        json.dump(data, writeJSON, ensure_ascii=False)
  </code></pre>