title: Not able to scrape the image url using BeautifulSoup
body: <p>I am trying to scrape this <a href="https://www.reuters.com/energy-environment" rel="nofollow noreferrer">website</a>. My code for <strong>scraping</strong> is.</p>
  <pre><code>from bs4 import BeautifulSoup
  import re
  
  root_tag=[&quot;article&quot;,{&quot;class&quot;:&quot;story&quot;}]
  image_tag=[&quot;img&quot;,{&quot;&quot;:&quot;&quot;},&quot;org-src&quot;]
  header=[&quot;h3&quot;,{&quot;class&quot;:&quot;story-title&quot;}]
  news_tag=[&quot;a&quot;,{&quot;&quot;:&quot;&quot;},&quot;href&quot;]
  txt_data=[&quot;p&quot;,{&quot;&quot;:&quot;&quot;}]
  
  
  
  import requests
  ua1 = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
  ua2 = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit 537.36 (KHTML, like Gecko) Chrome'
  headers = {'User-Agent': ua2,
             'Accept': 'text/html,application/xhtml+xml,application/xml;' \
                       'q=0.9,image/webp,*/*;q=0.8'}
  session = requests.Session()
  response = session.get(&quot;website-link&quot;, headers=headers)
  webContent = response.content
  
  
  bs = BeautifulSoup(webContent, 'lxml')
  all_tab_data = bs.findAll(root_tag[0], root_tag[1])
  
  output=[]
  for div in all_tab_data:
      image_url = None
      div_img = str(div)
      match = re.search(r&quot;(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png|jpeg)&quot;, div_img)
      print(match)
      # match = re.search(r&quot;([^\\s]+(\\.(?i)(jpg|png|gif|bmp))$)&quot;,div)
      if match != None:
          image_url = str(match.group(0))
      else:
          image_url = div.find(image_tag[0], image_tag[1]).get(image_tag[2])
      if image_url !=None:
          if image_url[0] == '/' and image_url[1] != '/':
              image_url = main_url + image_url
          if image_url[0] == '/' and image_url[1] == '/':
              image_url=&quot;https://&quot; + image_url[2:]
      output.append(image_url)
  </code></pre>
  <p>It is only giving one image_url and then giving error AttributeError: 'NoneType' object has no attribute 'get'</p>